It's ...

MRAB python at mrabarnett.plus.com
Thu Jun 25 19:22:48 CEST 2009


Angus Rodgers wrote:
> On Thu, 25 Jun 2009 10:31:47 -0500, Kirk Strauser 
> <kirk at daycos.com> wrote:
> 
>> At 2009-06-24T19:53:49Z, Angus Rodgers <twirlip at bigfoot.com> writes:
>>
>>> print ''.join(map(detab, f.xreadlines()))
>> An equivalent in modern Pythons:
>>
>>>>> print ''.join(line.expandtabs(3) for line in file('h071.txt'))
> 
> I guess the code below would also have worked in 2.1?
> (It does in 2.5.4.)
> 
>  print ''.join(line.expandtabs(3) for line in \
>  file('h071.txt').xreadlines())
> 
That uses a generator expression, which was introduced in 2.4.



More information about the Python-list mailing list