Skip to content
Simple CUI input prompt for Python
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs adding sphinx and tox initial configs Jan 3, 2015
prompter updating versioneer Nov 14, 2015
tests adding yesno Apr 13, 2014
.coveragerc switching to pytest Jan 25, 2015
.gitattributes testing out using versioneer Jan 14, 2015
.gitignore Initial commit Apr 12, 2014
.travis.yml adding 3.5 Nov 15, 2015
LICENSE Initial commit Apr 12, 2014
MANIFEST adding coveralls Jan 18, 2015
MANIFEST.in testing out using versioneer Jan 14, 2015
README.rst use latest click docs URL Mar 12, 2016
requirements.txt removing testing modules from requirements Apr 12, 2014
setup.cfg updating versioneer Nov 14, 2015
setup.py updating versioneer Nov 14, 2015
tox.ini switching to pytest Jan 25, 2015
versioneer.py

README.rst

prompter

https://travis-ci.org/tylerdave/prompter.svg?branch=master http://badge.fury.io/py/prompter.png https://coveralls.io/repos/tylerdave/prompter/badge.svg?branch=master

Simple CUI prompt input for Python

I mostly use click for CLI stuff now so I suggest taking a look here if you need anything more advanced: http://click.pocoo.org/latest/prompts/

Installing

Install the latest stable from PyPi:

pip install prompter

Install the latest development version from master:

pip install git+git://github.com/tylerdave/prompter

Using

>>> from prompter import prompt, yesno

>>> prompt('What is your name?')
What is your name? Dave
'Dave'

>>> prompt('What is your name?', default='Jenn')
What is your name? [Jenn]
'Jenn'

>>> prompt('What is your name?', default='Jenn', suffix='\n > ')
What is your name? [Jenn]
>
'Jenn'

>>> prompt('Enter text surrounded by spaces.', strip=False)
Enter text surrounded by spaces.    text
'   text   '

>>> yesno('Really?')
Really? [Y/n]
True

>>> yesno('Really?')
Really? [Y/n] no
False

>>> yesno('Really?', default='no')
Really? [y/N]
True

>>> yesno('')
[Y/n] n
False

Note

Please open an issue on Github if you notice problems or have suggestions!

You can’t perform that action at this time.