Quickstart with prompt()
masterUsing PyInquirer follows a two-step pattern similar to Inquirer.js:
- Define a list of questions.
- Pass them to the
promptfunction to receive a list of answers.
Use print_json from PyInquirer to easily inspect the resulting answers dictionary.
from __future__ import print_function, unicode_literals
from PyInquirer import prompt, print_json
questions = [
{
'type': 'input',
'name': 'first_name',
'message': 'What\'s your first name',
}
]
answers = prompt(questions)
print_json(answers) # use the answers as input for your app