Skip to content

Instantly share code, notes, and snippets.

@lambdaman2
Created October 1, 2012 12:44
Show Gist options
  • Save lambdaman2/3811448 to your computer and use it in GitHub Desktop.
Save lambdaman2/3811448 to your computer and use it in GitHub Desktop.
Python: Best way to choose a random file from a directory
import os, random
random.choice(os.listdir("C:\\")) #change dir name to whatever
@noufanpmc
Copy link

How to set the number of random files to be chosen ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment