alex23 wrote:
if you want a list of files from a single directory, use listdir, not walk:>>> import os, random >>> random.choice(os.listdir("/")) 'python25'This will include folders as well, though, which isn't what the OP asked for.
as illustrated by my example (cut and pasted from a windows machine). oops. random.choice(filter(os.path.isfile, glob.glob("/*"))) isn't that bad, though. </F> -- http://mail.python.org/mailman/listinfo/python-list