Python/MySQL execute in for gives error:- TypeError: 'int' object is not iterable
问题 I get the following error when I execute cursor in for loop. Traceback (most recent call last): File "mysql_select_query.py", line 35, in <module> for row in cur.execute(sql_select): TypeError: 'int' object is not iterable Here is my code that gives error: sql_select = "SELECT * FROM T_EMP" for row in cur.execute(sql_select): print("{}, {}, {}, {}".format(row[0], row[1], row[2], row[3])) It works well when I execute & use fetchall(): sql_select = "SELECT * FROM T_EMP where ID>%s" rows = cur