Python 3.x 如何更改默认程序以在Python中打开文件?
我正在使用os.startfile(path\file.stl)打开一个stl文件。默认情况下,STL文件在程序Print 3D(使用Windows 10)中打开。我希望Python程序不要在默认程序中打开STL文件,而是在Paint 3D(或我选择的其他STL查看程序)中打开。如何在非默认程序中打开文件Python 3.x 如何更改默认程序以在Python中打开文件?,python-3.x,stl,Python 3.x,Stl,我正在使用os.startfile(path\file.stl)打开一个stl文件。默认情况下,STL文件在程序Print 3D(使用Windows 10)中打开。我希望Python程序不要在默认程序中打开STL文件,而是在Paint 3D(或我选择的其他STL查看程序)中打开。如何在非默认程序中打开文件 import os os.startfile(r'C:\Users\my\path\to\file.stl') #opens file.stl in default program, not
import os
os.startfile(r'C:\Users\my\path\to\file.stl')
#opens file.stl in default program, not the program I would like
建议没有办法做到这一点(至少在os.startfile
中没有办法)
该文件将使用与其扩展名关联的任何应用程序(如果有)打开
除了os.startfile之外,您还知道其他方法吗?