Python从MP3文件获取id3的方法

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

相关文章

linux查找当前python解释器的位置方法

先进入python 输入 import sys sys.executable 即可! 以上这篇linux查找当前python解释器的位置方法就是小编分享给大家的全部内容了,希望能给...

Python threading的使用方法解析

Python threading的使用方法解析

一、 例子:我们对传参是有要求的必须传入一个元组,否则报错 import _thread as thread import time def loop1(in1): print(...

Python 迭代器工具包【推荐】

  原文:https://git.io/pytips   0x01 介绍了迭代器的概念,即定义了 __iter__() 和 __next__() 方法的对象,或者通过 yield 简化定...

如何利用Pyecharts可视化微信好友

如何利用Pyecharts可视化微信好友

前言 最近在研究 pyecharts  的用法,它是 python 的一个可视化工具,然后就想着结合微信来一起玩 不多说,直接看效果: 环境配置 pip ins...

详解Python中的join()函数的用法

函数:string.join() Python中有join()和os.path.join()两个函数,具体作用如下:     join(): &n...