On Sun, Sep 6, 2009 at 12:46 AM, hrishy<hris...@yahoo.co.uk> wrote:
> Hi Chris
>
> What if i want to log that bad data and continue processing is there a way to 
> do that ?

Tighten the area included in the try...except:

sum = 0
for item in readData:
    try:
        sum += int(item)
    except ValueError:
        print "Oops!  That was no valid number. Instead it was:", item

Also, in the future, please avoid top-posting
(http://en.wikipedia.org/wiki/Top-post).

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to