A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/065682.html below:

reading empty input

reading empty input reading empty inputSteve 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4