脚本之家,脚本语言编程技术及教程分享平台!
分类导航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服务器之家 - 脚本之家 - Python - Python从MP3文件获取id3的方法

Python从MP3文件获取id3的方法

2020-07-15 10:23小卒过河 Python

这篇文章主要介绍了Python从MP3文件获取id3的方法,实例分析了Python操作文件属性的相关技巧,需要的朋友可以参考下

本文实例讲述了PythonMP3文件获取id3的方法。分享给大家供大家参考。具体如下:

?
1
2
3
4
5
6
7
8
9
10
11
def getID3(filename):
  fp = open(filename, 'r')
  fp.seek(-128, 2)
  fp.read(3) # TAG iniziale
  title  = fp.read(30)
  artist = fp.read(30)
  album  = fp.read(30)
  anno  = fp.read(4)
  comment = fp.read(28)
  fp.close()
  return {'title':title, 'artist':artist, 'album':album, 'anno':anno}

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

延伸 · 阅读

精彩推荐