Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: python - 如何获取特定类启动的活动线程数?
我是python的新手,我想随时计算正在运行的线程数......是否有任何内置支持或者我必须手动维护它(例如count veriable......)?
threading.active_count()似乎是您正在寻找的:
返回当前存活的 Thread 对象的数量