I have this code and I couldn't run it because i get this error: "TypeError: 'classobj' object is not subscriptable" and here is my code:
import cgi
import customerlib
form=cgi.FieldStorage
history = customerlib.find(form["f_name"].value,form["l_name"].value)
print "Content-type: text/html"
print
print """<html>
  <head>
    <title>Purchase history</title>
  </head>
  <body>
    <h1>Purchase History</h1>"""
print "<p>you have a purchase history of:"
for i in history: "</p>"
   print"""  <body>
</html>"""
I have the customerlib file beside this file. Any idea how to fix it?
form=cgi.FieldStorage
FieldStorage is a class, not an object. You need to instantiate it to create a FieldStorage object:
form=cgi.FieldStorage()
It is erroring on form["f_name"] because form is currently an alias for the class of FieldStorage, not an object of type FieldStorage. By instantiating it, it's doing what you think it should be doing.
Check out the cgi module documentation for more detailed information on how to use the CGI module.