Return to Snippet

Revision: 41434
at February 18, 2011 00:09 by magicrebirth


Initial Code
import os, random
random.choice(os.listdir("C:\\")) #change dir name to whatever

Initial URL
http://stackoverflow.com/questions/701402/best-way-to-choose-a-random-file-from-a-directory

Initial Description


Initial Title
Best way to choose a random file from a directory

Initial Tags
file, python

Initial Language
Python