简体   繁体   English

如何在 macOS 上使用 Python 终止应用程序?

[英]How can I terminate an application using Python on macOS?

I have created a program and I want to make it exit Visual Studio Code once it is done with the program, how can I do that?我创建了一个程序,我想让它在程序完成后退出 Visual Studio Code,我该怎么做?

Possible solution is可能的解决方案是

import os
os.system('pkill <vs process name>')

..but it looks kind of lame. ..但它看起来有点蹩脚。 Consider to run your application from cli:考虑从 cli 运行您的应用程序:

python app.py

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM