已知查询的数据表中的数据超过5行,则执行程序后,下列说法正确的是?( )
有如下Python代码:
>import sqlite3
>conn = sqlite3.connect(‘cj.db’)
>cursor = conn.cursor()
>cursor.execute(‘SELECT * FROM student’)
>rows = cursor.fetchmany(5)
>for row in rows:
>print(row)
>cursor.close()
>conn.close()
链接的数据库文件是student
查询的数据表名称是select
若只想获取一条查询数据,可以将fetchmany()换成fetchall()
print(len(rows))得到的结果是5