7 Réponses
+ 3
well, it's not really running html inside of python...
the trick here only works in python sololearn code playground, wich allow outputing html code as soon as you create an image file (output is then turned to html to be able to append the image to the log)...
that's why there is the statement: os.system("touch file.png")
+ 2
yes.
+ 1
Please see the code
https://code.sololearn.com/cF5HF4d046rk/?ref=app
+ 1
Hey visph Can you tell me more about this?
I am interested in knowing why output is getting converted to html only(not other file format) when empty image file is created?
Also, what is the log that you mentioned in the comments?
+ 1
visph Let me summarise what I have understood:
How it works?
Whenever we type any code in sololearn playground, it will first execute it, and store the result in a file called log.
Before ml course, this log file used to display results normally but with the introduction of ml course they need to add the support for showing images.
Therefore, they added this and if an image is created then they convert all the output to html(instead of text) and show it in the console and since they are showing the html output if there is any valid html code inside the script we created, it will also run that and show it to us!
Am i right?
0
no, you cannot "run" html code inside of python...
0
that's a feature from sololearn: they introduced it for lessons about machine learning and so on...
the "log" I talked about is the script output (done on sololearn servers, and then returned to be displayed)... Programing languages initialy use basic (raw text) output, and is unable to display graphics, or even colors/animation... so the workaround was to use the html-based output to enhance the capacities ;)