📜  os.startfile on raspberry - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:03.707000             🧑  作者: Mango

代码示例1
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])