[Tutor] Re: Testing for punctuation in a string
Greg Brunet
gbrunet at sempersoft.com
Mon Oct 13 04:21:47 EDT 2003
"Alan Gauld" <alan.gauld at blueyonder.co.uk> wrote in message
news:002f01c390e1$3d153ff0$6401a8c0 at xp...
> Ultimately you will have to test each character but you want to
> do it in C rather than Python. However the best I can think of
> is a comprehension:
>...
Hi Alan:
Yes - I can see how comprehension would be slightly more efficient.
OTOH, I want to kick out as soon as I see ANY error condition, so I may
stay with a standard FOR loop with a sys.exit (after displaying an error
message) if I find any bad characters. Thanks for the ideas,
--
Greg
More information about the Tutor
mailing list