我有一个Python脚本,我的家人用来播放随机孩子的电视节目在我们的媒体中心。 我的妻子告诉我,该方案似乎有利于节目的相同的选择。 有没有一种方法,使之更加随机,使其从一些不同的选择挑选?
提前致谢。
这就是我目前正在使用:
import glob,random,os
files = glob.glob("D:\Recorded TV\Bubble Guppies*.wtv")
files.extend(glob.glob("D:\Recorded TV\Doc McStuffins*.wtv"))
files.extend(glob.glob("D:\Recorded TV\Mickey Mouse Clubhouse*.wtv"))
files.extend(glob.glob("D:\Recorded TV\Octonauts*.wtv"))
files.extend(glob.glob("D:\Recorded TV\Team Umizoomi*.wtv"))
files.extend(glob.glob("D:\Recorded TV\Jake and the Never Land Pirates*.wtv"))
files.extend(glob.glob("D:\Recorded TV\PAW Patrol*.wtv"))
files.extend(glob.glob("D:\Recorded TV\Yo Gabba Gabba*.wtv"))
files.extend(glob.glob("D:\Recorded TV\Henry Hugglemonster*.wtv"))
files.extend(glob.glob("D:\Recorded TV\Wallykazam*.wtv"))
files.extend(glob.glob("D:\Recorded TV\Dora the Explorer*.wtv"))
files.extend(glob.glob("D:\Recorded TV\Jungle Junction*.wtv"))
files.extend(glob.glob("D:\Recorded TV\Little Einstein*.wtv"))
files.extend(glob.glob("D:\Recorded TV\The Wonder Pets*.wtv"))
files.extend(glob.glob("D:\Recorded TV\WordWorld*.wtv"))
file = random.choice(files)
print "Opening file %s..." % file
cmd = "rundll32 url.dll,FileProtocolHandler \"" + file + "\""
os.system(cmd)