【发布时间】:2015-06-30 13:38:26
【问题描述】:
我有一个程序,我分别启动 3 个线程。我使用的是 2.4.3 版本。
thread.get_ident() 我猜在这个版本的 Python 中不可用。
我使用threading.currentThread(),但它只返回给我:
<_MainThread(MainThread, started)>
在其他版本 (3.3.3) 我得到类似的东西
<_MainThread(MainThread, started 5420)>
其中5420 表示线程ID。如何在 Python 2.4 版本中获取此 ID?
【问题讨论】:
-
此链接可能对您有所帮助 [stackoverflow.com/questions/919897/…
-
这是它返回的
<Thread(Thread-1, started)>
标签: python multithreading process pid