String manipulation questions

goldtech goldtech at worldpost.com
Wed Apr 9 11:33:35 EDT 2008


snip...
>
>    for counter, line in enumerate(fileIN):
>        newline = line.replace(oldstring, newstring)
>        if newline != line:
>            print 'match at line', counter+1
>        fileOUT.write(newline)

"enumerate" - haven't seen that before. Nice!

Thanks



More information about the Python-list mailing list