Python从MP3文件获取id3的方法

yipeiwu_com5年前Python基础

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

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程序设计有所帮助。

相关文章

python 将print输出的内容保存到txt文件中

具体代码如下所示: import sys import os class Logger(object): def __init__(self, filename="Default...

python 控制Asterisk AMI接口外呼电话的例子

Asterisk 是一个开放源代码的软件VoIP PBX系统,我们用Asterisk 搭建企业内部电话系统。 Asterisk AMI的Asterisk管理接口。可以实现对Asteris...

python 接口返回的json字符串实例

如下所示: JSON 函数 使用 JSON 函数需要导入 json 库:import json。 函数 描述 json.dumps 将 Python 对象编码成 JSON 字符串...

Python max内置函数详细介绍

Python max内置函数 max(iterable, *[, key, default]) max(arg1, arg2, *args[, key]) Return the larg...

Python离线安装PIL 模块的方法

Python离线安装PIL 模块的方法

python的库一般都用pip安装。 但是有时候也会出现在线安装失败的情况,如下图安装PIL模块时报错: 这时候可以采取离线安装的方式; 一、首先下载离线安装包 PIL官方版不支持py...