import time
class Video(object):
def __init__(self,path):
self.path = "C:/Program Files (x86)/QuickTime/QuickTimePlayer.exe"
def play(self):
from os import startfile
startfile(self.path)
class Movie_MP4(Video):
type = "MP4"
movie = Movie_MP4(r"C:\Users\A\1.mp4")
movie.play()
如果我将“C:/ Program Files(x86)/QuickTime/QuickTimePlayer.exe”更改为路径,我可以使用此代码播放Windows媒体播放器文件。
如何快速播放视频?
答案 0 :(得分:0)
更改
self.path = "C:/Program Files (x86)/QuickTime/QuickTimePlayer.exe"
到
self.path = path
替代:
使用subprocess.call()
或subprocess.Popen()
- 请参阅他们的文档here