Fork自 CSDN 技术社区 / skill_tree_python
体验新版 GitCode,发现更多精彩内容 >>
# -*- coding: UTF-8 -*- # 作者:幻灰龙 # 标题:Python 多线程 # 描述:多线程打印 n import threading import time def map_process(n): time.sleep(n) print(n) def test(): numbers = range(0, 3) for n in numbers: x = threading.Thread(target=map_process, args=(n,)) x.start() if __name__ == '__main__': test()