← 返回题库
中级

实现设备列表分页查询

未完成
中级参考 代码结构已给出,请填写 ____ 处
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
Python 代码 🔒 登录后使用
🔒

登录后即可练习

注册免费账号,在浏览器中直接运行 Python 代码