首页 > 解决方案 > PTable 中的箭头导航

问题描述

我正在为学校制作一个关于汽车数据库的项目。我使用模块 PTable 来显示汽车,我想知道我是否可以以及如何使用诸如questionary之类的东西来选择将要删除的汽车,并带有箭头导航:

questionary.select(
    "What car do you want to remove?",
    choices=[
            *table goes here i asume*
    ]).ask()

我该怎么办?

这就是我现在拥有的:

cur = cursor.execute("SELECT id, brand, price, year, licensePlate, isLeasingCar from cars")
t = PrettyTable(["ID", "Brand", "Price [kr.]", "Year", "License plate", "Is car leased?"])
for row in cur:
    if row[5]:
        leasing = "Ja"
    else:
        leasing = "Nej"
    t.add_row([row[0], row[1], row[2], row[3], row[4], leasing])
print(t)
questionary.select(
    "What car do you want to remove?",
    choices=[

    ]).ask()

我使用:从漂亮表导入问题导入漂亮表

标签: pythonsql

解决方案


推荐阅读