#NEWLINE# def prompt( name , default = None ) : #NEWLINE# #INDENT# '\n    Grab user input from command line.\n\n    :param name: prompt text\n    :param default: default value if no input provided.\n    ' #NEWLINE# prompt = ( name + ( ( default and ( ' [%s]' % default ) ) or '' ) ) #NEWLINE# prompt += ( ( name . endswith ( '?' ) and ' ' ) or ': ' ) #NEWLINE# while True : #NEWLINE# #INDENT# rv = input ( prompt ) #NEWLINE# if rv : #NEWLINE# #INDENT# return rv #NEWLINE# #UNINDENT# if ( default is not None ) : #NEWLINE# #INDENT# return default