iterate lines with regex

Jochen Schulz ml at well-adjusted.de
Sat Aug 1 15:55:31 EDT 2009


Michael Savarese:
> 
> for line in readThis:
>     try:
>         thisKey = key.search(line).group(1)
>         thisMap = map.search(line).group(1)
>         thisParcel = parcel.search(line).group(1)
>     except:
>         continue

Why do you catch all exceptions in that loop? Remove the try-except
clause including the 'continue' and a stacktrace will probybably tell
you why your loop appears to do nothing.

J.
-- 
A passionate argument means more to me than a blockbuster movie.
[Agree]   [Disagree]
                 <http://www.slowlydownward.com/NODATA/data_enter2.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20090801/83a91b76/attachment.sig>


More information about the Python-list mailing list