Python In HTML
How To Read A CSV Into A HTML Table With Python
A lot can been done with a CSV (“comma separated value”) file. If you can run a web scraping script on your local machine, you can FTP the results to a FTP site in the ubiquitous CSV format, and then render it on your web page with HTML. The rest of this post demonstrates a […]
How To Make A Select Drop Down List In Python
(Login: demo, 123) In the above example, I demonstrate what a drop down list on a Python webpage looks like. Here’s the code: #!/usr/bin/python print “Content-type: text/html\n\n” print “” print “” print “Select Quiz Dropdown Example” print “” print “” print “” print “” print “” #GLOBAL VARIABLES USERNAME = ‘admin’ PASSWORD = ‘pwd’ DB […]
Python Project – Online Quiz Management – Adding Quizzes
Now it’s time to add some functionality to add quizzes. So first we have to make a MySQL table to hold the main quiz text: (view structure after the table is created) Now this is where the questions for the quiz will be entered. Please note, that this is a “parent/child” type database setup, the […]
How To Get Query Parameters In Python
A necessity is using Python in HTML is the ability to pass query parameters from page to page. You are going to want to do this passing as you move from page to page, or you submit values from the page you are currently on to itself to be entered into the database. This process […]
Python Project – Online Quiz Management
I am going to be implementing some Python projects with a browser front end (obviously since that’s what this domain is called), I am going to be focusing on the core functionality, not really the aesthetics. You can always use some stylesheets (CSS) to make it look pretty. I am just concerned with the fact […]
Adding An Application Switchboard
We want to direct “traffic” to where we want them to go, so we are going to add a navigational component called a “switchboard”. Any page that’s called index.htm or index.php is going to show up first, when someone enters that URL. That looks more professional than just seeing a list of files in that […]
How To Use Python To Update MySQL
In this post we will be updating our MySQL database using Python. #!/usr/bin/python print “Content-type: text/html\n\n” print “<html>” print “<head>” print “<title>Update Provider</title>” print “</head>” print “<body>” #GLOBAL VARIABLES USERNAME = ‘username’ PASSWORD = ‘password’ DB = ‘database’ import MySQLdb import os # Import modules for CGI handling import cgi, cgitb def init(): #read the […]
How To Have Python Delete From A MySQL Table
In out last post we covered how to add a new record to the MySQL database. In this post will add to the previous and show you how to delete a record from the database. First of all we are going to add 2 new columns to our datasheet below: This will allow us to […]
Use The Data Entry Form To Have Python Insert Data Into MySQL
In our previous post we showed how to enter data into a data entry form and display the values on the screen. In this post, we will continue the concept, but we are actually going to enter it into our MySQL database. Here are a few changes we are making: Python Global Variables In A […]