reading empty input
Steve Purcell
stephen_purcell at yahoo.com
Wed Apr 18 05:31:49 EDT 2001
Janos Blazi wrote:
> a=-1
> while a!="empty":
> a=input()
> if "a!=empty": <commands>
>
> this is pseucode of course. The while loop should run until the user
> responds to the input prompt by the enter key (and no real input)
>
> How can I do this? Have I to use raw_input?
Yes:
def command(s):
print "command:", s
while 1:
a = raw_input()
if not a: break
command(a)
print "finished"
-Steve
--
Steve Purcell, Pythangelist
Get testing at http://pyunit.sourceforge.net/
Any opinions expressed herein are my own and not necessarily those of Yahoo
More information about the Python-list
mailing list