繁体   English   中英

Python 的初学者 - 询问者的问题

[英]Beginner at Python - problem with inquirer

我刚刚开始学习 Python 并且我坚持使用代码(如下)。 我不知道出了什么问题,但我无法选择药物,RDV 不断出现两次。 有什么帮助吗?

list = [inquirer.List(
  "Medicine",
  message="Choose from the given list",
  choices=("RDV", "MOL", "TCZ", "DEX"),
),]

answer = inquirer.prompt(list)

print (answer["Medicine"])

我想这就是你想要的

#! /usr/bin/env python3

from PyInquirer import prompt

questions = [
    {
        'type': 'list',
        'name': 'Medicine',
        'message': 'Choose from the given list',
        'choices': ["RDV", "MOL", "TCZ", "DEX"]
    }
]

answers = prompt(questions)
print(answers)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM