I want to open a random file from a given directory. I tried this:
import os, random
random.choice(os.listdir("C:\\"))
but it's not working. I tried this on the other hand:
import os, random
random.choice([x for x in os.listdir("C:\\") if os.path.isfile(os.path.join("C:\\", x))])
It worked but it's only listing the files in the directory but not starting them. How do I start these files?