How to prompt a free type question with list of options in python inquirer?

686 views Asked by At

I'm looking for something like this:

[?] Question: <free type here or one of choices>
 > 1
   2
   3

So the user's answer wont be limited to 1, 2 or 3. But inquirer only lets me do either List or Text. List doesn't allow free type, Text has no choices. Is there a way to do this? Should I give up inquirer in favor of another library?

1

There are 1 answers

1
blueteeth On BEST ANSWER

You could offer another option, and then offer free text if they choose that.

import inquirer

choice = inquirer.list_input("What choice?", choices=["1", "2", "3", "Other"])
if choice == "Other":
    result = inquirer.text("Enter text: ")