擅长:python、mysql、java
<p>您可以参考以下代码。在</p>
<pre><code>import threading
def func1():
for i in range(10):
print("gibberish")
def func2():
print("pass")
t1 = threading.Thread(target=func1)
t2 = threading.Thread(target=func2)
if __name__ == '__main__':
t1.start()
t2.start()
</code></pre>
<p>它所做的是,同时运行方法<code>func1</code>和<code>func2</code>,以便所提供的方法彼此作为后台任务运行。在</p>