do you guys help newbies??

Simon Brunning SBrunning at trisystems.co.uk
Wed Nov 27 11:20:13 EST 2002


> From:	Wojtek Walczak [SMTP:gminick at hacker.pl]
> Dnia Wed, 27 Nov 2002 15:53:20 GMT, Robin Munn napisał(a):
> > You could also do this in one step, like:
> >     gallonsPerTank = int(raw_input("Enter how many gallons..."))
> It of course works, but there's a large amount of situations to think of.
> 
> ---
> import sys
> try:
>    while 1:
>       a = raw_input("Put a digit here: ")
>       if not a.isdigit():
>          a = raw_input("Put a digit here: ")
>       else:
>          a = int(a)
>          break
> except:
>    print sys.exc_info()[1]
>    sys.exit()
> 
> print a
> ---
> 
> Any ideas to make it more reliable ?
 
See <http://www.linuxgazette.com/issue83/evans.html>.

Cheers,
Simon Brunning
TriSystems Ltd.
sbrunning at trisystems.co.uk





-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.




More information about the Python-list mailing list