python程序启动其他python程序,如何使用Python启动应用程序的实例?
I am creating a Python script where it does a bunch of tasks and one of those tasks is to launch and open an instance of Excel. What is the ideal way of accomplishing that in my script?
解決方案
While the Popen answers are reasonable for the general case, I would recommend win32api for this specific case, if you want to do something useful with it:
It goes something like this:
from win32com.client import Dispatch
xl = Dispatch('Excel.Application')
wb = xl.Workbooks.Open('C:\\Documents and Settings\\GradeBook.xls')
xl.Visible = True # optional: if you want to see the spreadsheet
Taken from a mailing list post but there are plenty of examples around.
總結
以上是生活随笔為你收集整理的python程序启动其他python程序,如何使用Python启动应用程序的实例?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: xp系统自带的"计算器"不见了怎么办
- 下一篇: 如何制作活码二维码?