Python 3.0 automatic decoding of UTF16

D'Arcy J.M. Cain darcy at druid.net
Sun Dec 7 10:14:30 EST 2008


On Sun, 07 Dec 2008 16:05:53 +0100
Johannes Bauer <dfnsonfsduifb at gmx.de> 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 druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



More information about the Python-list mailing list