Python 可以使用单独的媒体播放器打开 mp3 文件吗? [英] Can Python open a mp3 file using a separate media player?

查看:74
本文介绍了Python 可以使用单独的媒体播放器打开 mp3 文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 Python 中打开 mp3 文件(可以使用 Popen),我的意思不是在程序中运行它,我的意思是作为单独的窗口在媒体播放器中或任何只是为了在我调用函数时打开它,如果是这样,如何?

解决方案

使用关联的应用程序打开文件(仅限Windows):

导入操作系统os.startfile('my_mp3.mp3')

文档链接可以在这里找到.>

Is it possible to open an mp3 file in Python (possible using Popen) and I don't mean to run it in the program I mean as a separate window in media player or whatever just for it to open it when I call the function and if so how?

解决方案

Opening a file with its associated application (Windows only):

import os
os.startfile('my_mp3.mp3')

A link to the documentation can be found here.

这篇关于Python 可以使用单独的媒体播放器打开 mp3 文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆