How can I launch an instance of an application using Python?

后端 未结 7 1453
北恋
北恋 2020-12-09 04:57

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 i

7条回答
  •  甜味超标
    2020-12-09 05:30

    The subprocess module intends to replace several other, older modules and functions, such as:

    • os.system
    • os.spawn*
    • os.popen*
    • popen2.*
    • commands.*

    .

    import subprocess
    
    process_one = subprocess.Popen(['gqview', '/home/toto/my_images'])
    
    print process_one.pid
    

提交回复
热议问题