I'm trying to open files in a directory that doesn't have just .jpg files in it here's the code i wrote:
import os
import random
import time, shutil
path=(r"C:\Users\KIMEDIAS\Desktop\Noice\PYTHON")
files=os.listdir(path)
d = random.choice(files)
os.startfile(d)
time.sleep(2)
quit()
Can someone help me so i can specify the file type it open's. And, if you can make it close the process and delete the file after some seconds.