Tuesday, February 19, 2013
3:48 PM

Python read all rows of MySQL table


Below python code print all first column values of table in MySQL

query="SELECT * from table_name"
cursor.execute(query)

row = cursor.fetchone() 
while row is not None:
print(row[1])
row = cursor.fetchone()

0 comments:

Post a Comment