thanks Benno. supplying 3.6 GB file is over-kill for the script. This is the reason I chose to input lines on fly.
thanks Kumar ----- Original Message ---- From: Benno Lang <transmogribe...@gmail.com> To: kumar s <ps_pyt...@yahoo.com> Cc: tutor@python.org Sent: Mon, March 15, 2010 7:19:24 PM Subject: Re: [Tutor] raw_input() On 16 March 2010 08:04, kumar s <ps_pyt...@yahoo.com> wrote: > %cat mybigfile.rod | python x1.py > Traceback (most recent call last): > File "x1.py", line 2, in <module> > second = raw_input() > EOFError: EOF when reading a line > > How to notify that at EOF break and suppress exception. try: second = raw_input() except EOFError: # handle error in some way I would probably supply the file name as an argument rather than piping into stdin (or allow both methods), but that's up to you. HTH, benno _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor