How can I use threading in Python?

前端 未结 19 2667
迷失自我
迷失自我 2020-11-21 04:54

I am trying to understand threading in Python. I\'ve looked at the documentation and examples, but quite frankly, many examples are overly sophisticated and I\'m having trou

19条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-21 05:11

    Given a function, f, thread it like this:

    import threading
    threading.Thread(target=f).start()
    

    To pass arguments to f

    threading.Thread(target=f, args=(a,b,c)).start()
    

提交回复
热议问题