如何使Python查询器在Pycharm中工作?

2024-06-16 09:57:32 发布

您现在位置:Python中文网/ 问答频道 /正文

你好, 我试图在python控制台中创建一个交互式菜单。我发现PythonInquirer应该适合我的用途,但是当我运行它时,它在PyCharm中不起作用,它只是打印出选项,我不能选择任何东西。有人知道我的问题是什么以及如何解决吗?我真的很高兴能得到任何帮助

from pprint import pprint
import inquirer

questions = [
    inquirer.List(
        "size",
        message="What size do you need?",
        choices=["Jumbo", "Large", "Standard", "Medium", "Small", "Micro"],
    ),
]

answers = inquirer.prompt(questions)
pprint(answers)

代码只是从python inquirer文档复制粘贴而来的 当我运行它时没有错误,它就是不工作


Tags: fromimportmessagesize选项菜单what用途