I am going to show you how to run a simple Hello World program using web.py ( a python framework). You should install web.py framework in you PC before you attempt this. Open notepad, copy all the below code and save the file with some name with extension .py
import web # for including all the web contents urls=( '/','Index' # Here we are specifying URLs ) # Here the template that we need to display in our HTML Page tmp=""" <html> <head> <title>Testing Web.py</title> </head> <body> <center> <h2>Hello world</h2> </center> </body> </html>""" #class name class Index: def GET(self): return tmp #main funtion if __name__=='__main__': app=web.application(urls,globals()) app.run()I saved the above file as sample.py. Then you can run this program like this Take terminal and go to the specified path where you saved the python file. In my case I saved the file in Desktop. Go to the Specified path like this – C:\Users\DELL\Desktop\ Then type the name of python file followed by the port number that we need to run the page.
C:\Users\DELL\Desktop>python sample.py 9999Click enter to run the program. Then it will show the localhost address where the file is running.
C:\Users\DELL\Desktop>python sample.py 9999 http://0.0.0.0:9999/
The webpage is running in the http://0.0.0.0:9999/Open a browser and paste the address, then you can view your “Hello World” web page. Hope you will try after reading this. Thanks for reading and kindly submit your feedback.