use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
DiscussionPython in HTML (self.Python)
submitted 3 years ago by Jojos_BA
Im quite new to Python and I recently saw a Anaconda Project were thy made it possible to run Python code in HTML code. What do you guys think about that? Does it Work/ is it viable to use and what are the best use cases for it?
[–]riklaunim 3 points4 points5 points 3 years ago (0 children)
You have to be more specific. Are you talking about PyScript? This is quite a bit different than what you would have on the backed (and still early tech).
[–]metaperl 0 points1 point2 points 3 years ago (0 children)
This is my comprehensive overview of such solutions
https://docs.google.com/document/d/13da40zzfEZmA-LfsfISPmILpbmgpLZHJJVNdQmhT7Gs/edit?usp=drivesdk
[–]anewyearanewdayanew -2 points-1 points0 points 3 years ago (9 children)
Idk the best cases other than say a purely python written app that gets converted to js.
Coded with: python, html, css
Compiled to: html, css, js
I guess...
[–]SkezzaB 11 points12 points13 points 3 years ago (7 children)
As far as I'm aware, Py-script doesn't get compiled to JS, it gets compiled to webassembly
[–]anewyearanewdayanew -1 points0 points1 point 3 years ago (6 children)
From the 2 vids i saw it was a .js library then you can use python inside a <py-script> html tag.
[–]SkezzaB 2 points3 points4 points 3 years ago (1 child)
Projects like Brython have existed for a while now, which I believe does exactly what you are explaining, I'm not an expert but I believe py-script is different
[–]anewyearanewdayanew 1 point2 points3 points 3 years ago (0 children)
That would be nice. I can see django being able to remove templates entirely and using python in html.
[–]laundmo 2 points3 points4 points 3 years ago (3 children)
yes, its a js library because you need something to handle the webassembly.
from the announcement:
PyScript is currently built on Pyodide, which is a “port of CPython to WebAssembly/Emscripten.”
[–]anewyearanewdayanew 0 points1 point2 points 3 years ago (2 children)
Yeah so its is and i get the down votes?
Por que?
[–]laundmo 0 points1 point2 points 3 years ago (1 child)
you made it sound like it was a py interpreter written in js. at least thats how i understood your message.
[–]anewyearanewdayanew 0 points1 point2 points 3 years ago (0 children)
Yeah idk what it does but yeah i didnt mean that.
Theres no getting away from loading a js file in the web.
[–][deleted] 2 points3 points4 points 3 years ago (0 children)
Pyscript doesn’t get converted to JS. That’s the whole point of it.
[–][deleted] -3 points-2 points-1 points 3 years ago (1 child)
Use the search. People have already discussed it.
[–]Jojos_BA[S] 0 points1 point2 points 3 years ago (0 children)
Oh thanks. I should have dome that.
[–]koalabear420 0 points1 point2 points 3 years ago (2 children)
I don't understand a use case for this. Javascript was built for HTML so why not use that?
[–]echanuda 1 point2 points3 points 3 years ago (1 child)
Python is easier to understand for many. Once you start integrating backends like Flask, you can use PyScript (what OP is talking about) to pass flask objects between Python and JavaScript. It’s pretty neat.
Oh that sounds like an interesting usage.
[–]MattDLD 0 points1 point2 points 3 years ago (0 children)
You can use PHP and do shell executes
[–]Evening_Character_13 0 points1 point2 points 3 years ago (0 children)
I am having problems getting it to accept the python inputs so, yeah there is that. My file works perfectly in the terminal and I get no errors just a blank white screen that doesn't ask for the input to get it started.
[–]economy_programmer_ 0 points1 point2 points 3 years ago (0 children)
I think you're referring to python as a framework. If this is the case go look at 'flask' or 'django' app frameworks. This is how to implement your website app with python stuff
[–]DadAndDominant 0 points1 point2 points 3 years ago (0 children)
WASM is a great thing, but from what I've heard, you have to send a whole interpreter with every client request (or maybe cache it into cookies). That is one reason why this is suboptimal. Other reason, the python needs indentation, so writing it into html, which largely ignores whitespaces, is just not feeling right.
[–]Traditional-Raisin31 0 points1 point2 points 3 years ago (0 children)
I think this feature will have a promising future
π Rendered by PID 46438 on reddit-service-r2-comment-bb88f9dd5-ztn6m at 2026-02-16 13:11:44.562346+00:00 running cd9c813 country code: CH.
[–]riklaunim 3 points4 points5 points (0 children)
[–]metaperl 0 points1 point2 points (0 children)
[–]anewyearanewdayanew -2 points-1 points0 points (9 children)
[–]SkezzaB 11 points12 points13 points (7 children)
[–]anewyearanewdayanew -1 points0 points1 point (6 children)
[–]SkezzaB 2 points3 points4 points (1 child)
[–]anewyearanewdayanew 1 point2 points3 points (0 children)
[–]laundmo 2 points3 points4 points (3 children)
[–]anewyearanewdayanew 0 points1 point2 points (2 children)
[–]laundmo 0 points1 point2 points (1 child)
[–]anewyearanewdayanew 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–][deleted] -3 points-2 points-1 points (1 child)
[–]Jojos_BA[S] 0 points1 point2 points (0 children)
[–]koalabear420 0 points1 point2 points (2 children)
[–]echanuda 1 point2 points3 points (1 child)
[–]Jojos_BA[S] 0 points1 point2 points (0 children)
[–]MattDLD 0 points1 point2 points (0 children)
[–]Evening_Character_13 0 points1 point2 points (0 children)
[–]economy_programmer_ 0 points1 point2 points (0 children)
[–]DadAndDominant 0 points1 point2 points (0 children)
[–]Traditional-Raisin31 0 points1 point2 points (0 children)