r/pythonhelp • • May 01 '21

HOMEWORK how to run python file on web browser like HTML

so I want to know that how to run python file on web browser like HTML file with the same python code.

4 Upvotes

3 comments sorted by

3

u/Akshaykadav May 01 '21

I don't think you can run a python file in a web browser. Certain modules can convert python code to javascript and there are frameworks like Flask & Django, but that's not your question.

Upvoting the post so that you get a concrete answer.

3

u/structurefall May 01 '21

You need a web server. Fortunately, that's pretty easy to do!

Flask is the go-to web server in my experience. If you're relatively comfortable with Python you can probably get going with that in a matter of minutes. It also has a ton of bells and whistles you might need later.

If you happen to need async functionality, the aiohttp library provides its own web server.

There are a ton of other options but if you're just trying to get going now, I'd choose one of those.

1

u/vsinghalus Jul 14 '21

Check out www.cellstrathub.com - free online python and AI programming environment.