python 调起wps 打开 excel
pip install pypiwin32
import win32api
win32api.ShellExecute(0, 'open', r"C:\Users\Admin\Desktop\py\excel.xlsx", '','',1)
路径是绝对路径!!!
这么些可以写成变量
current_dir = os.path.dirname(os.path.abspath(__file__))
print(current_dir)
path = current_dir +"/"+ filename
path = path.replace("\\", "/")
path = path.replace("/", "\\\\")
print(path)
win32api.ShellExecute(0, 'open', path, '','',1)