lambdamusic
2/7/2013 - 9:24 PM

Python: Best way to choose a random file from a directory

Python: Best way to choose a random file from a directory

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