好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

python实现定时播放mp3

程序很简单,主要是 mp3play 模块的应用

import mp3play, time
 
filename = "Should It Matter.mp3"
clip = mp3play.load(filename)
while 1:
  if time.localtime().tm_min % 30 == 0:
    clip.play()
    print "\nStart to play"
    time.sleep(clip.seconds())
    clip.stop()
    print "Stop"
  print '>',
  time.sleep(30) #暂停30秒(不是30分钟)

 

演示图:

以上所述就是本文的全部内容了,希望大家能够喜欢。

查看更多关于python实现定时播放mp3的详细内容...

  阅读:59次