📜  如何在 python 脚本中运行 shell 命令 ctrl + c - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:17.155000             🧑  作者: Mango

代码示例1
# Pressing Ctrl-C sends a SIGINT signal to your program. 
# You can do that yourself from the command line with "kill INT xxxx" 
# where xxxx is the PID of the program.

import os
import signal

os.kill(p.pid,signal.SIGINT)