can i run html code in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

can i run html code in python?

I observed that I can run HTML code in python on Sololearn with following code: print('<h1>python</h1>') import os os.system('touch file.png') why is that so? It doesn't work on other IDEs.

26th Oct 2021, 4:14 PM
Harsha S
Harsha S - avatar
4 Answers
+ 3
sololearns system is linux based. Hence, the 'touch' command. Your os my not be a linux distro
26th Oct 2021, 4:25 PM
Slick
Slick - avatar
+ 2
Slick is there a way to run it in windows?
26th Oct 2021, 4:29 PM
Harsha S
Harsha S - avatar
+ 2
There's no touch in windows but you could use fsutil: fsutil file createnew filename  requiredSize just sub in the options and use it as a string to feed to os.system() read about it here: https://www.windows-commandline.com/create-empty-file/
26th Oct 2021, 4:35 PM
Slick
Slick - avatar
+ 2
On windows you can use "echo > filename to create files using powershell
28th Oct 2021, 7:26 AM
JUSTIN KPAKPA
JUSTIN KPAKPA - avatar