+ 1
Unwanted .png icon
There is a .png icon under my python output, how do I remove it? https://sololearn.com/compiler-playground/c5GhE2t4YatW/?ref=app
3 odpowiedzi
+ 5
Add these lines to your code to disable the image icon:
#remove broken image icon due to empty .png
print("<style>img{display:none;}</style>")
Sololearn's runtime environment looks for a .png file in order to determine whether to enable html interpretation of the Python console output. Enabling html display was added as a little trick so they could display images generated by pyplot in order to provide courses in Data Science and Finance.
Example:
https://sololearn.com/compiler-playground/crLP7COCBD7w/?ref=app
+ 2
Thanks Brian, I didn't know img needs to be stylized to not display!
+ 1
Best I can tell, somehow opening and writing to a PNG file glitches the Python environment into parsing and rendering the printed HTML instead of just displaying it as is. This is probably because the environment is designed to detect that you wrote to an image file, and display it with a universal web render system, that then happens to run on the HTML printout as well.
The number of metaphorical side roads you went on to get this to happen seems rather extensive.