Ask coding questions

← Back to all posts
How can I pick a random file from a folder?
h
oskxzr

Hello!

I am trying to get a random file from a folder for a discord bot command.

I have a folder of photos, and I don't know how to send a random photo back when the command photo is used.
(I know how to send the photo, not get it though)

How can I pick a random photo from a folder of photos?
Thank you!

Comments
hotnewtop
19ecal

In Python: