中级
实现设备列表分页查询
未完成
中级参考
代码结构已给出,请填写 ____ 处
def solve():
from pyodide.http import open_url
from io import StringIO
import pandas as pd
scr_csv = open_url(____).read()
screens = pd.read_csv(StringIO(____))
PAGE_SIZE = ____
def query(____):
f = screens.copy()
if region: f = f[f['____']==region]
if status: f = f[f['____']==status]
f = f.sort_values(____)
if cursor:
idx = f[f['____']==cursor].index
if len(____): f = f[f.index > idx[____]]
page = f.head(____)
next_cursor = page.iloc[-____]['____'] if len(____)==page_size else None
return page[['____','____','____']].to_dict(____), next_cursor
items, next_cur = query(____)
print(____)
print("____"+str(len(____))+"____"+str(____))
for item in items[:____]:
print(____)
示例
输入
solve()
期望输出
Query region=朝阳 status=online: Items: 20 next_cursor=SCR-0106 SCR-0001 LCD-720P-V online SCR-0006 LCD-720P-H online SCR-0011 LCD-720P-H online
👑
升级 VIP
解锁全部题目,畅通无阻地学习
- ✓ 解锁全部训练包所有题目
- ✓ 查看完整参考代码和提示
- ✓ 浏览器内直接运行 Python 代码
- ✓ 自动批改 + 进度追踪
30天
¥18
1年
¥99
2年
¥158
3年
¥199