Okay, the 1st option seems more complicated and the 2nd option, while simpler to my eye makes me worry about file descriptors, resource management and memory running out.
My files are large, hence 1 character at a time, not f.read(). This is code from another employee and I'm just in the stages of going through it and doing a basic clean-up before I get on to a proper efficiency assessment, hence I don't want to change the way it works, just make it as short and lucid as I can. Your suggestion using the generator expression again seems more complex than the original. They're good suggestions though. Thank you! I'm just now catching up with everybody's comments. Some of them seem quite entriguing. -- http://mail.python.org/mailman/listinfo/python-list