Python 3.0 automatic decoding of UTF16

D'Arcy J.M. Cain darcy at
Sun Dec 7 16:14:30 CET 2008

On Sun, 07 Dec 2008 16:05:53 +0100
Johannes Bauer <dfnsonfsduifb at> wrote:
> But, seriously - I find that whole "while True:" and "if line == """
> construct ugly as hell, too. How can reading a file line by line be
> achieved in a more pythonic kind of way?

for line in open(filename):
  <do stuff with line>

D'Arcy J.M. Cain <darcy at>         |  Democracy is three wolves                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.

More information about the Python-list mailing list