我阅读了很多文章,但是找不到其他条件的解决方案。可悲的是我的循环永不停止。似乎它并没有反复检查project.IsInProgress()= True
是否如果语句仍然为True,我想每两秒检查一次,如果不再为True,我想中断重复并执行打印语句。
我想问题是它两秒钟都没有运行该功能。但我不知道该如何处理。
check_status = project.IsInProgress()
while check_status:
print('Render in progress..')
time.sleep(2)
else:
print('Render is finished')
您的代码很好!您不需要在这里其他。当条件失败时,您将退出循环,并打印完成的语句。
check_status = project.IsInProgress()
while check_status:
print('Render in progress..')
time.sleep(2)
print('Render is finished')
尝试一下:
while project.IsInProgress():
print('Render in progress..')
time.sleep(2)
print('Render is finished')
或者,如果您愿意:
check_status = project.IsInProgress()
while check_status:
print('Render in progress..')
time.sleep(2)
check_status = project.IsInProgress()
print('Render is finished')