waling a directory with very many files
mk.fraggod at gmail.com
Tue Jun 16 01:31:53 CEST 2009
On Mon, 15 Jun 2009 15:35:04 -0400
Terry Reedy <tjreedy at udel.edu> wrote:
> Christian Heimes wrote:
> > Terry Reedy wrote:
> >> You did not specify version. In Python3, os.walk has become a generater
> >> function. So, to answer your question, use 3.1.
> > I'm sorry to inform you that Python 3.x still returns a list, not a
> > generator.
> >>> type(os.walk('.'))
> <class 'generator'>
> However, it is a generator of directory tuples that include a filename
> list produced by listdir, rather than a generator of filenames
> themselves, as I was thinking. I wish listdir had been changed in 3.0
> along with map, filter, and range, but I made no effort and hence cannot
Why? We have itertools.imap, itertools.ifilter and xrange already.
Mike Kazantsev // fraggod.net
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 205 bytes
Desc: not available
More information about the Python-list