magmax/python-inquirer

[newbie] get answer without any stuff

Askeo opened this issue · 1 comments

Askeo commented
import os
import sys
from pprint import pprint

sys.path.append(os.path.realpath("."))
import inquirer  # noqa

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

answers = inquirer.prompt(questions)

pprint(answers)

How can i modify the example that the print(answer) only output the selection of the user input, at the moment you get:

{'size': 'Large'}

but i only want to receive Large without brakets and the "name" like size

answers var is a dictionary, so you can use:

pprint(answers["size"])