I'm trying example listed in How do I connect to a MySQL Database in Python?
When I try to execute the program in Python 3.0 GUI I receive error for last print statement
for x in range(0,numrows):
row = cursor.fetchone()
print row[0], "-->", row[1]
Error is Invalid Syntax for row[0]
Any Pointers would be helpful.
Thanks, Siva
in python3 print is a function, so it's print(row[0]+"-->"+row[1])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.