题库首页 › 青少年软件编程(Python) › 题目 15629

物流轨迹跟踪系统中若需获取前3条记录,以下哪种方式最高效?( ) conn = sqlite3.connect('logistics.db') cursor = conn.cursor() cursor.execute(''' SELECT track_id, location, timestamp FROM tracking WHERE package_id = ? ORDER BY timestamp DESC''', ('PKG12345',)) # 获取最新轨迹 latest_record = cursor.fetchone()

A:[cursor.fetchone() for _ in range(3)]
B:cursor.fetchmany(3)
C:cursor.fetchall()[:3]
D:循环调用fetchone()三次

正确答案:B

试卷来源:202506 青少年软件编程等级考试Python六级真题

本卷相关题目

在线做题 同科目题库