ldo at geek-central.gen.new_zealand
Fri Jul 25 06:38:45 CEST 2008
In message <mailman.514.1216797917.922.python-list at python.org>, Fredrik
> Lanny 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.
> if you want a list of files from a single directory, use listdir, not
> >>> import os, random
> >>> random.choice(os.listdir("/"))
Won't that return any subdirectories as well as files?
More information about the Python-list