I have just started learning Python and I am stuck with the code (below). I don't know what is wrong but I am unable to choose the medicine and RDV keeps showing twice. Any help?
list = [inquirer.List(
"Medicine",
message="Choose from the given list",
choices=("RDV", "MOL", "TCZ", "DEX"),
),]
answer = inquirer.prompt(list)
print (answer["Medicine"])
I think this is what you want
#! /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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.