Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

select random img in python using os.listdir

import random, os
path = r"C:UsersGDesktopscientific-programming-2014-masterscientific-programming-2014-masterhomeworkassignment_3cifar-10-pythoncifar-10-batches-py"
random_filename = random.choice([
    x for x in os.listdir(path)
    if os.path.isfile(os.path.join(path, x))
])
print(random_filename)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #select #random #img #python
ADD COMMENT
Topic
Name
7+2 =