Kurt Fagerburg - 2009-07-28

I'm a newbie. Hopefully this question isn't too silly.

I am working on a script that will select data from a MySQL database and compare values of fields within the result set. Below is my code:

import MySQLdb

conn = MySQLdb.connect(host = "localhost",
user = "someuser",
passwd = "password",
db = "somedatabase")
cursor = conn.cursor()
stringSQL = "SELECT * FROM Table"
cursor.execute(stringSQL)
rows = cursor.fetchall()
for item in rows[0]:
print item
conn.close()

If I do something like: print rows[0] the script returns a list:
('Lastname', 'Firstname', 'title', 'address1', 'City', 'state', 'zip','phone')

The way I have the script written above it returns this:
Lastname
Firstname
title
address1
City
state
zip
phone

My problem is that I can't figure out how to access a subitem. I'd like to access only the Lastname, for example. But if I try something like this: print item[0]

I get:

Traceback (most recent call last):
File "/home/kfagerb/Sandbox/mysqlTestScript.py", line 12, in <module>
print item[0]
IndexError: string index out of range

And: print item(0) gives me:

Traceback (most recent call last):
File "/home/kfagerb/Sandbox/mysqlTestScript.py", line 12, in <module>
print item(0)
TypeError: 'str' object is not callable

Can someone point me in the right direction here?