我想知道,如果没有选择任何行,那么selected返回什么,它是NULL还是其他:
情商
cursor.execute(Select * from table where data= "YES")发布于 2015-11-03 17:18:38
当查询返回数据时,应用如下:
import MySQLdb
conn = MySQLdb.Connection(...)
curs = conn.cursor()
print curs.execute("select * from cities where city like 'San %'")
51 //51 rows found
rows = curs.fetchall()
print len(rows)
51 // as stated above 51 rows found但是,如果查询返回0行,则会得到一个空列表
if not rows:
# empty set returnedhttps://stackoverflow.com/questions/33505096
复制相似问题