wgPython 2019-01-03
想通过编写Python代码来打开本地的.mp4格式文件,使用os模块来操作文件。我的电脑默认的是QQ影音播放器,执行Python代码打开默认播放器,播放代码中指定的视频文件。
class Video(object): def __init__(self,path): self.path = path def play(self): from os import startfile startfile(self.path) class Movie_MP4(Video): type = 'MP4' movie = Movie_MP4(r'D:\my_video.mp4') movie.play()
[参考链接:https://stackoverflow.com/questions/21313542/how-to-open-a-mp4-file-with-python ]