Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pythons os module choose random file

import os
import random
import dircache

dir = 'some/directory'
filename = random.choice(dircache.listdir(dir))
path = os.path.join(dir, filename)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pythons #os #module #choose #random #file
ADD COMMENT
Topic
Name
2+5 =