Python Web Tutorial #1
Click the button below to run a simple Python script.
Script 1. python-web-tutorial-1.py
Create a basic Python script that prints Hello World. Name the script python-web-tutorial-1.py.
print("Coder Fairy: Hello World!")
Script 2. python-web-tutorial-1.php
Create a php script that runs the Python script, stores the output of Python’s print statement, and then prints the results to the webpage. Name this script python-web-tutorial-1.php. python-web-tutorial-1.py in the script below should match the name of your Python script from the previous step.
Script 3. python-web-tutorial-1.html
Create a html and Javascript script. The html portion creates a button with the id of “myButton“. The Javascript portion that calls the php script from step 2 to gets the print statement from the Python script and then prints the output.
In the code below, replace https://coderfairy.com/code/python-web/1/python-web-tutorial-1.php with the location that you saved your php script in the previous step.
My Page