Gettings subdirectories
Ben Finney
bignose+hates-spam at benfinney.id.au
Wed May 3 19:00:59 EDT 2006
"BartlebyScrivener" <rpdooling at gmail.com> writes:
> >> root, dirnames, filenames = os.walk(r"C:\").next()
>
> Wow. How does that work? Just point me to where I can read about it. I
> don't see it under os.walk.
We must be reading different Python websites.
walk(top[, topdown=True [, onerror=None]])
walk() generates the file names in a directory tree, by walking
the tree either top down or bottom up. For each directory in the
tree rooted at directory top (including top itself), it yields a
3-tuple (dirpath, dirnames, filenames).
<URL:http://docs.python.org/lib/os-file-dir.html#l2h-1638>
--
\ "Sittin' on the fence, that's a dangerous course / You can even |
`\ catch a bullet from the peace-keeping force" -- Dire Straits, |
_o__) _Once Upon A Time In The West_ |
Ben Finney
More information about the Python-list
mailing list