How to obtain a Thread id in Python?

后端 未结 8 805
时光说笑
时光说笑 2020-12-02 08:01

I have a multi-threading Python program, and a utility function, writeLog(message), that writes out a timestamp followed by the message. Unfortunately, the resu

8条回答
  •  粉色の甜心
    2020-12-02 08:47

    threading.get_ident() works, or threading.current_thread().ident (or threading.currentThread().ident for Python < 2.6).

提交回复
热议问题