"Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> In <[EMAIL PROTECTED]>, Tim Arnold wrote:
>
<snip>

> ....  Untested:
>
> import os, sys, codecs
>
> def checkfile(filename):
>    f = codecs.open(filename,encoding='ascii')
>
>    try:
>        for num, line in enumerate(f):
>            pass
>    except UnicodeError:
>        print 'problem: line %d' % num
>
>    f.close()
>
> Ciao,
> Marc 'BlackJack' Rintsch

Thanks Marc,
That looks much cleaner. I didn't know the 'num' from the enumerate would 
persist so the except block could report it.

thanks again,
--Tim


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to