pyhton--多线程原理
#创建2个线程
import threading def first(): for i in range(100): print(1) def two(): for j in range(100): print(2) if __name__ == '__main__': a=threading.Thread(target=first) b=threading.Thread(target=two) a.start() b.start()
#创建2个线程
import threading def first(): for i in range(100): print(1) def two(): for j in range(100): print(2) if __name__ == '__main__': a=threading.Thread(target=first) b=threading.Thread(target=two) a.start() b.start()