Best way to choose a random file from a directory


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import os, random
  2. random.choice(os.listdir("C:\\")) #change dir name to whatever

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.