Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- import random, os
- path = r"A:\myfile"
- random_filename = random.choice([
- x for x in os.listdir(path)
- if os.path.isfile(os.path.join(path, x))
- ])
- print(random_filename)
- image = Image.open(random_filename)
- image.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement