[Tutor] Does try-except "lock out scope" or similar?

Benjamin Serrato benjamin.serrato at gmail.com
Tue Mar 8 05:40:24 CET 2011


I wrote a short script to clean up a csv file but had trouble when

date_time = time.strptime(date_string, "%m/%d/%y")

 would choke on intermittent Null characters in the file.  I put it into a
try-except, but then I found I couldn't do

del row

because I receive a "row is not defined" complaint or similar.  So, how do I
run time.strptime() without locking myself out. And, what is the pretty way
to do all of this, because a couple hours later it looks pretty ugly. I mean
it turns out I'm rewriting the file anyway so no need to delete the row.

http://pastebin.ws/e0prlj

Regards,
Benjamin Serrato
682.472.8650
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110307/9ec9f522/attachment.html>


More information about the Tutor mailing list