We need to define a main function in which we query the database. The main() function will include a simple loop for iterating through the rows of the table as follows:
def main(): for c in xrange(len(records)): fvalues = records[c] print fvalues if fvalues == sys.argv: print fvalues
Here we set up a for loop which runs from 1 (understood) to whatever the length of the table is. For each row, the entire row is read into 'fvalues'. If the first value in the row is equal to the string the program received from the user, the record is printed.