可以检索当前进程的进程ID os.getpid()(当然也存在其他更复杂的方法).
import os
print "This process has the PID", os.getpid()
Run Code Online (Sandbox Code Playgroud)
在bash中,您可以使用$$获取运行脚本的bash实例的PID.
| 归档时间: |
|
| 查看次数: |
4705 次 |
| 最近记录: |