问题遇到的现象和发生背景
在FOR循环下运行,第一次循环运行正常,第二次循环time_local = time.localtime(time1)终止
问题相关代码,请勿粘贴截图
time1 = jobs['time']
print('time1',time1)
time_local = time.localtime(time1)
print('time_local',time_local)
# time2 = str(time1)
# 转换成新的时间格式(精确到秒)
time3 = time.strftime("%Y-%m-%d %H:%M:%S", time_local)
print(time3) # 2021-11-09 09:46:48
#print('time2',time2)
time = []
time.append(time3)
print('time',time)
运行结果及报错内容
time1 1640109638
time_local time.struct_time(tm_year=2021, tm_mon=12, tm_mday=22, tm_hour=2, tm_min=0, tm_sec=38, tm_wday=2, tm_yday=356, tm_isdst=0)
2021-12-22 02:00:38
time ['2021-12-22 02:00:38']
time1 1640035455
Process finished with exit code 0
我想要达到的结果
在FOR循环下,一直运行