Home  >  Article  >  Backend Development  >  Python读取mp3中ID3信息的方法

Python读取mp3中ID3信息的方法

WBOY
WBOYOriginal
2016-06-06 11:21:591664browse

本文实例讲述了Python读取mp3中ID3信息的方法。分享给大家供大家参考。具体分析如下:

pyid3不好用,常常有不认识的.
mutagen不错,不过默认带的easyid3不会读取注释,需要手工hack一下

Python代码如下:

from mutagen.mp3 import MP3
import mutagen.id3
from mutagen.easyid3 import EasyID3
EasyID3.valid_keys["comment"]="COMM::'XXX'"
id3info = MP3("xxx.mp3", ID3=EasyID3)
for k, v in id3info.items():
  print k,v

希望本文所述对大家的Python程序设计有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn