我有一些Python代码可以创建恶魔线程.父线程几乎立即结束,但守护程序线程保持打印睡眠.
import threading
import time
def int_sleep():
for _ in range(1, 600):
time.sleep(1)
print("sleep")
def main():
thread = threading.Thread(target=int_sleep)
thread.daemon = True
thread.start()
time.sleep(2)
print("main thread end...")
thread = threading.Thread(target=main)
thread.start()
Run Code Online (Sandbox Code Playgroud)
内容sys.version:
'3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC v.1600 64 bit (AMD64)]'
Run Code Online (Sandbox Code Playgroud)
打印:
sleep
main thread end...
sleep
sleep
sleep
Run Code Online (Sandbox Code Playgroud)
当父线程退出时,为什么Python守护程序线程不会退出?
使用 statsmodels python 包拟合 ARIMA 模型的常用方法是:
model = statsmodels.tsa.ARMA(series, order=(2,2))
result = model.fit(trend='nc', disp=1)
Run Code Online (Sandbox Code Playgroud)
但是,我有多个时间序列数据可供训练,例如,来自同一底层过程,我该怎么做?