0

Python and html

How do I use sololearn to renter this as a webpage? I would guess a webserver would just accept this script's html output as a *.py file. Or something? https://code.sololearn.com/cL31N2Kz4r3W/?ref=app

19th Jul 2022, 5:37 AM
ρү૨œdԌ૨ ×
ρү૨œdԌ૨ × - avatar
6 Answers
+ 2
ρү૨œdԌ૨ × At the beginning write: import os At the end write: os.system("touch .png") Then it will render as HTML. If you want CSS, do: print(""" <style> /* Put your CSS code here */ </style> """) And as far as I know, JS (JavaScript) does not work using this method.
19th Jul 2022, 10:52 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
+ 1
ρү૨œdԌ૨ × I don't know much about how it works, but you can try and tweak the code to make it work.
25th Jul 2022, 12:44 AM
MyNameIsNotBob
MyNameIsNotBob - avatar
0
Did you mean 'touch .html' ? why would I need to create a png file? If thats the case nice. I would still wonder how to get a webserver to use .py files ^^
20th Jul 2022, 2:44 AM
ρү૨œdԌ૨ ×
ρү૨œdԌ૨ × - avatar
0
ρү૨œdԌ૨ × It works with .png at the end.
20th Jul 2022, 1:06 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
0
That makes no sense. I use Archlinux so I know that touch command creates a file or updates timestamps on an existing file. Am I wrong somehow that that os.system() method creates a file on a Unix like system?
24th Jul 2022, 11:40 PM
ρү૨œdԌ૨ ×
ρү૨œdԌ૨ × - avatar
0
A webserver is going to think its a binary file not code.
24th Jul 2022, 11:41 PM
ρү૨œdԌ૨ ×
ρү૨œdԌ૨ × - avatar