mardi 25 juillet 2017

The random.shuffle doesn't work

Why I can't shuffle this?

from random import shuffle, random
# to listen to all the files in the dir

def listen():
    '''listens to all the mp3 in the dir'''
    folder = os.listdir()
    shuffle(folder,random)
    for files in folder:
        if files.endswith(".mp3"):
            os.startfile(files)

The result is always in the same order... I tried also sample and other stuff, but the result is the same.




Aucun commentaire:

Enregistrer un commentaire