What is pyscript ??
PyScripter is javascript but with python keywords ,Its a flexible framework that developers can build on to create extensible components directly in Python easily like javascript but more easier, Developed by a team from Anaconda including Peter Wang, Fabio Pliger, and Philipp Rudiger, it’s, as Peter mentioned in his talk, “a system for interleaving Python in HTML (like PHP). » This means you can write and run Python code in HTML, call Javascript libraries in PyScript, and do all your web development in, so it’s a javascript librairie
How To Say Hello World ??
In normal html template we import the library in script tag ( the css is used to style the script output )
<!DOCTYPE html> <html> <head> <title>Page Title</title> <!-- pyscript --> <link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" /> <script defer src="https://pyscript.net/alpha/pyscript.js"></script> </head> <body> </body> </html>
now lets say hello world 🙂
<!DOCTYPE html> <html> <head> <title>Page Title</title> <!-- pyscript --> <link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" /> <script defer src="https://pyscript.net/alpha/pyscript.js"></script> </head> <body> <py-script> print("Hello World !!") #We just created a new world !! </py-script> </body> </html>
0 Comments