有关python播放MP3歌曲 [英] Playing mp3 song on python

查看:141
本文介绍了有关python播放MP3歌曲的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从蟒蛇玩我的歌(MP3),你可以给我做一个简单的命令?

这是不正确的:

 进口波
W = wave.open(E:/ LOCAL /背叛者/ Metalik Klinik1-安卡Sekolah.mp3,R)


解决方案

您可以试试这个,简单,但也许不是最好的方法。

 从pygame的进口龙头#加载所需的库mixer.init()
mixer.music.load('E:/ LOCAL /背叛者/ Metalik Klinik1-安卡Sekolah.mp3')
mixer.music.play()

请注意, MP3 的支持是有限的(如在文档中告诉的)

有关安装说明,请访问 http://pygame.org/install.html

I want to play my song (mp3) from python, can you give me a simplest command to do that?

This is not correct:

import wave
w = wave.open("e:/LOCAL/Betrayer/Metalik Klinik1-Anak Sekolah.mp3","r")

解决方案

You may try this, simplistic but not the best method maybe.

from pygame import mixer # Load the required library

mixer.init()
mixer.music.load('e:/LOCAL/Betrayer/Metalik Klinik1-Anak Sekolah.mp3')
mixer.music.play()

Please note that the support for MP3 is limited (as told in the docs)

For installation instructions, visit http://pygame.org/install.html

这篇关于有关python播放MP3歌曲的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆