wuwei23 at gmail.com
Wed Jul 23 09:06:31 CEST 2008
On Jul 24, 11:52 am, "Lanny" <la... at freshells.ch> wrote:
> How would one make a list of the files in the top directory
> using os.walk.
> I need to pick a random file from said list.
So you -only- want the files from one directory?
Try: _, _, files = os.walk('/top/folder/here').next()
The single underscore is a convention to indicate we don't care about
The .next() is needed to step through os.walk once, which will start
at the path you specify.
Hope this helps.
More information about the Python-list