每一天的生活,不再为一点小事悲痛动怒,会安安心心,简简单单,做一些能让自己开心的事。不要过分在意一些人,过分在乎一些事,顺其自然,以最佳的心态应对。
本文实例讲述了python使用win32com库播放mp3文件的方法。分享给大家供大家参考。具体实现方法如下:
# Python supports COM, if you have the Win32 extensions # check your Python folder eg. D:\Python23\Lib\site-packages\win32com # also http://starship.python.net/crew/mhammond/win32/Downloads.html # this program will play MP3, WMA, MID, WAV files via the WindowsMediaPlayer from win32com.client import Dispatch mp = Dispatch("WMPlayer.OCX") # use an mp3 file you have ... #tune = mp.newMedia("C:/Program Files/Common Files/HP/Memories Disc/2.0/audio/Swing.mp3") # or copy one to the working folder ... #tune = mp.newMedia("Bier1.mp3") # you can also play wma files, this cool sound came with XP ... tune = mp.newMedia("C:/WINDOWS/system32/oobe/images/title.wma") mp.currentPlaylist.appendItem(tune) mp.controls.play() # to stop playing use raw_input("Press Enter to stop playing") mp.controls.stop()
希望本文所述对大家的Python程序设计有所帮助。
到此这篇关于python使用win32com库播放mp3文件的方法就介绍到这了。世界没有任何变化,只是彼此不再是彼此的牵挂。等不到天黑,烟花不会太完美,回忆烧成灰,还是没有结尾……她静悄悄地来过,他慢慢带走沉默。最后彼此的承诺,消逝在空中楼阁。做错了也不后悔,跌倒了就重新爬起来,要记住:学会坚强,学会自信,永远做生活的强者。更多相关python使用win32com库播放mp3文件的方法内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!