Tuesday 19 February 2013

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()

Share This!



No comments:

Post a Comment

Here We Write The Problems we face at different situations and Solutions to those problems.