os.walk question

alex23 wuwei23 at gmail.com
Wed Jul 23 15:16:50 CEST 2008


On Jul 23, 10:11 pm, Larry Bates <larry.ba... at websafe.com`> wrote:
> import glob
> random.choice([f for f in glob.glob(root, "*")])

glob.glob only accepts one argument though, did you mean root + "*"?

It also returns folders as well as files, though, and the list
comprehension is not necessary given it returns a list itself.



More information about the Python-list mailing list