Advertisement
Guest User

Untitled

a guest
Jan 19th, 2022
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. from PIL import Image
  2. import random, os
  3. path = r"A:\myfile"
  4. random_filename = random.choice([
  5. x for x in os.listdir(path)
  6. if os.path.isfile(os.path.join(path, x))
  7. ])
  8. print(random_filename)
  9.  
  10. image = Image.open(random_filename)
  11. image.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement