[英]How do I play .MP3 files in Python?
How do I play an MPs file in Python? 如何在Python中播放MPs文件? I have tried
我努力了
import os
os.system("start C:/thepathyouwant/file")
and every time I get the error: "couldn't locate file" I am working on a text based RPG, and I only want to add an MP3 file for music. 每次出现错误:“无法找到文件”时,我正在研究基于文本的RPG,而我只想添加音乐的MP3文件。 I'm just starting out in Python, and don't know much about Pyglet.
我只是从Python开始,对Pyglet并不了解。 I attempted an install using the command line:
我尝试使用命令行进行安装:
python setup.py install
In the "Run" window. 在“运行”窗口中。
I also attempted to install pyglet.msi, but I recieved the error: 我也尝试安装pyglet.msi,但收到错误消息:
pyglet requires Python 2.4 or later. The installation will be aborted
running Python 2.7.9 running Windows 8 运行Python 2.7.9运行Windows 8
Thanks! 谢谢!
You can use startfile function in os module to play your file.Consider this example: 您可以在os模块中使用startfile函数来播放文件。请考虑以下示例:
import os
os.startfile('C:/Users/Aakash/Desktop/songs/Anime.mp3')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.