This question already has answers here:
Play a Sound with Python [duplicate]
(10个答案)
7年前关闭。
我将如何在Python中播放
(10个答案)
7年前关闭。
我将如何在Python中播放
.wma
文件?假设文件名为Scream.wma
最佳答案
http://wiki.python.org/moin/Audio/的音频库列表很长。列表中甚至还有一个名为wave的文件,仅用于WAV文件。除了那些你可以使用PyGame:
import pygame
import pygame.mixer
pygame.mixer.music.load('file.wav')
pygame.mixer.music.play()