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
6 Antworten
+ 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.
+ 1
ρү૨œdԌ૨ × I don't know much about how it works, but you can try and tweak the code to make it work.
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 ^^
0
ρү૨œdԌ૨ ×
It works with .png at the end.
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?
0
A webserver is going to think its a binary file not code.