This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def easy_input (prompt, defaultValue=None): | |
'''Doc string: idiomatically read input with optional default value: | |
''' | |
prompt = '%s%s: ' % (prompt, ('[%s]' % defaultValue) if defaultValue is not None else '') | |
var = raw_input(prompt) | |
if not var: | |
var = defaultValue | |
return var |
NewerOlder