我更喜欢限制重试的次数,这样,如果该特定项目有问题,您最终将继续进行下一个,因此:for i in range(100): for attempt in range(10): try: # do thing except: # perhaps reconnect, etc. else: break else: # we failed all the attempts - deal with the consequences.