import pygameimport time #导入音乐文件file = r'C:\1.wav'pygame.mixer.init()track = pygame.mixer.music.load(file) pygame.mixer.music.play()time.sleep(5)pygame.mixer.music.stop()