
On 16/08/2021 16:54, Mebale Tsige Araya wrote:
Your question could mean several different things. I'll give very brief answers to each below but you will need to give more specific information for more specific answers. 1) Can I embed Python code in an HTML page and have the browser execute it like JavaScript. No. But you can get Python to JavaScript translators or languages that look like Python (CoffeeScript) that are converted to JavaScript by the server. There are at least 2 very old browsers that do run Python internally but they are used by nobody in the realm world! 2) Is there a web site that lets me enter python code without Python being installed on my device? Yes. There are a few sites that present a virtual terminal online that lets you code python inside a browser. The code actually runs on the server but the input and results appear in the browser. The caveat is that they usually have limited support for modules and they don't allow you to install third party add-ons beyond what the site owner has installed (numpy may be there for example) 3) Can I write web site code in Python that will generate web pages that can be seen in a browser? Yes, there are many, many web frameworks for python from the super sophisticated (eg Zope) to substantial but practical for humans (eg Django) to simple ones for quick and dirty developments (eg Flask) And you can use the cgi module in the standard library for very basic web development. If that's not enough or you meant something different then repost with more details, perhaps even describing what you want to do with it. HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos

Alan is not incorrect here (Python doesn't *natively* run in browser), but these days that's an increasingly meaningless distinction (even if we aren't there *yet*!). There are a couple of approaches to running Python in browser: * Transpilation approaches like Brython: https://brython.info/static_tutorial/en/index.html * WASM approaches like Pyodide - https://pyodide.org/en/stable/ Pyodide is *newer*, and is used by JupyterLite to run JupyterLab in the browser without a backing server. I won't add anything to Alan's other answers, as I think they fully cover it!

To pile on, if you are looking for help learning Python, there is another mailing list called python-list@python.org. They will be much more supportive with answering your questions. There is also a community on Reddit called r/learnpython that is very supportive. This mailing list is for proposing new features or changes to Python itself.

Alan is not incorrect here (Python doesn't *natively* run in browser), but these days that's an increasingly meaningless distinction (even if we aren't there *yet*!). There are a couple of approaches to running Python in browser: * Transpilation approaches like Brython: https://brython.info/static_tutorial/en/index.html * WASM approaches like Pyodide - https://pyodide.org/en/stable/ Pyodide is *newer*, and is used by JupyterLite to run JupyterLab in the browser without a backing server. I won't add anything to Alan's other answers, as I think they fully cover it!

To pile on, if you are looking for help learning Python, there is another mailing list called python-list@python.org. They will be much more supportive with answering your questions. There is also a community on Reddit called r/learnpython that is very supportive. This mailing list is for proposing new features or changes to Python itself.
participants (3)
-
Alan Gauld
-
Angus Hollands
-
Jack DeVries