On Mon, 26 Feb 2018 01:50:16 +1100, Chris Angelico wrote:

> If you actually need character-by-character, you'd need "for character
> in fh.read()" rather than iterating over the file itself. Iterating over
> a file yields lines.

Indeed. But I wonder if there's a performance cost/gain to iterating over 
each line, rather than reading one char at a time?

for line in file:
    for c in line:
        ...

Too lazy to actually test it myself, but just tossing this idea out in 
case anyone else cares to give it a try.


-- 
Steve

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

Reply via email to