How do I hide the console when I use os.system() or subprocess.call()?

后端 未结 5 493
难免孤独
难免孤独 2020-11-22 07:58

I wrote some statements like below:

os.system(cmd) #do something
subprocess.call(\'taskkill /F /IM exename.exe\')

both will pop up a consol

5条回答
  •  盖世英雄少女心
    2020-11-22 08:51

    Try to change the extension from .py to .pyw

    Its basically just a Python User Interface file. So it opens up a new Window without the command line. chech this link (filext.com/file-extension/PYW)

提交回复
热议问题