How to Run Python on a Webpage?

The Python language uses CGI to execute on a Web page. You must import the “cgitb” library for the Python language to execute and display the results in a Web browser. The Python language uses small statements that make it suitable for large or small Web projects. You can display any content and work with dynamic or static pages using Python.


1. Launch your Python editor and open the source code file you want to use to print information to a Web page.

2. Add the “cgitb” library to the top of the file. Import the cgitb libraries to allow your Python code to work with HTML processes. Add the following code to the top of your page: import cgitb cgitb.enable()


3.Set the “Content Type” headers. The headers tell the browser that the output is HTML. Add the following code to set the content type: start_response(‘200 OK’, [(‘Content-Type’, ‘text/html’)])


4. Display a piece of HTML code. For instance, the following code displays “Hello, World” in bold text using HTML: print “<b> Hello, World</b>”


Stop Chrome JavaScript

1.Click the wrench icon in the top right corner of the Chrome browser and select “Settings” from the menu to open the Settings page.

2.Click the “Show advanced settings” link at the bottom of the page to view advanced settings.


3.Click the “Content settings” button in the Privacy section to open the Content Settings window.


4.Click the “Do not allow any site to run JavaScript” radio button in the JavaScript section.


5.Click “OK” to save the settings and close the Content Settings window.


Stop Chrome Extensions


1.Click the wrench icon in Chrome and select “Settings” from the menu.

2. Click “Extensions” in the left pane to view all extensions.

3. Click the “Enabled” button to the right of the extension you want to stop to remove the check mark. This stops the extension.


The latest blog on various topics including Artificial intelligence, Machine learning, Internet of Things, is also for helping scholars who are pursuing Ph.D. in various fields. The content is  also available in the form of video in our channel the description is given below  

TechDoctorIn  Channel was developed for Learning New About Artificial Intelligence, Machine Learning and With Innovative Project Ideas. TechDoctorIn Channel has the Following Playlists

Channel link:


Google Scholar:

TechDoctorIn is a very useful educational channel run by Dr. Pawan Whig Senior IEEE Member. The content is verified by him at it is very useful.

Leave a Comment

Your email address will not be published.