random pick any file from directory python

Do you want to know the details regarding “random pick any file from directory python”. If yes, you’re in the correct article.

random pick any file from directory python

import os, random
random.choice(os.listdir("C:\\")) #change dir name to whatever

Final Thoughts

I hope this tutorial helps you to know about “random pick any file from directory python”. If you have any doubts regarding this article please let us know via the comment section. Share this post with your friends and family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment