This article is the second in a series of articles about data mining tools written in Python CGI that make common data mining tasks faster and easier. The first article in the series can be seen here: Data Mining Tools: Column to Array This tool is very similar to the previous tool, except it is … Continue reading Data Mining Tools: Row to Array
CGI
Data Mining Tools: Column to Array
I have created some Python tools that make data mining easier. For example, when moving lots of data around one thing that comes up often is getting information from a spreadsheet into a Python data container such as a list. This can be done by adding some code in a Python script to open an … Continue reading Data Mining Tools: Column to Array
Python on the web: How to get a list of all available Python modules
If you want to get a complete list of Python modules available on your web host, you can do so with the following code: I saved the above code as a CGI script called “available_modules.py” and uploaded it to my website cgi-bin. Here is what the code produces, shown below in an iframe: For more … Continue reading Python on the web: How to get a list of all available Python modules
Python on the web: How to delete cookies in a CGI script
After you have a cookie that has been set, here is how you can delete it. The trick is to send an update to the cookie where you feed it an expiration date that is already in the past. For example: print “Set-Cookie: xml_edit_tool=Value of cookie; ‘expires=Wed, 28 Aug 2013 18:30:00 GMT’ \r\n” Note: When … Continue reading Python on the web: How to delete cookies in a CGI script
Python on the web: How to update cookies in a CGI script
Once you’ve retrieved a cookie via a function that returns the cookie as a dictionary of key value pairs, you can update the cookie in nearly the same way that you originally set the cookie. The only difference is that this time you can set different values. In this example, I am passing the retrieved … Continue reading Python on the web: How to update cookies in a CGI script
Python on the web: How to get cookies in a CGI script
In this previous article I detailed how to set cookies in a CGI script: Python on the web: How to set cookies in a CGI script In this article I am going to describe how to get those cookies in a CGI script. Get ‘HTTP_COOKIE’ from the Environment variables. Account for the fact that this … Continue reading Python on the web: How to get cookies in a CGI script
Python on the web: How to get a CGI script to recognize two submit buttons with separate values in one form
In one of my Python cgi scripts I have a web form with some hidden values, text fields, and two submit buttons. I want my cgi script to do something different depending on which submit button was clicked. One of the submit buttons is for completing a review without making any changes and is called … Continue reading Python on the web: How to get a CGI script to recognize two submit buttons with separate values in one form
Python on the web: How to set cookies in a CGI script
I am working on a Python CGI web tool that allows a user to traverse through a long list of xml elements, where each element appears on the screen one at a time. The tool allows the user to make changes to editable fields and creates a report of the deltas, as well as a … Continue reading Python on the web: How to set cookies in a CGI script