Initial revision

This commit is contained in:
Hans Lambermont
2002-10-12 11:37:38 +00:00
commit 12315f4d0e
1699 changed files with 444708 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import string
def userquery( prompt, choices, contextdata = '', defaultind=0 ):
if contextdata:
print 'Contextual Information:', contextdata
for x in range( len( choices ) ):
print '(%s)'%x, `choices[x]`
choice = raw_input( prompt+( '(%s):'%defaultind ) )
if not choice:
return choices[ defaultind ]
try:
choice = string.atoi( choice )
return choices[ choice]
except IndexError :
return choices[ defaultind ]
except ValueError:
return choice