📅  最后修改于: 2022-03-11 14:47:03.707000             🧑  作者: Mango
import os, sys, subprocess
def open_file(filename):
if sys.platform == "win32":
os.startfile(filename)
else:
opener = "open" if sys.platform == "darwin" else "xdg-open"
subprocess.run([opener, filename])