Python 3.x 在dict中重新迭代for循环

Python 3.x 在dict中重新迭代for循环,python-3.x,Python 3.x,每次服务器禁止我的ip(60秒)时,getid()方法都会给出一个非类型错误。我希望在每次出现错误时都重复循环实例,以避免遗漏某个项目。我如何做到这一点 for t in soup.find_all("div",{"class":"vItem Normal"}): try: if(t["data-exterior"]=="Not Available"): continue name.append(t[

每次服务器禁止我的ip(60秒)时,getid()方法都会给出一个非类型错误。我希望在每次出现错误时都重复循环实例,以避免遗漏某个项目。我如何做到这一点

for t in soup.find_all("div",{"class":"vItem Normal"}):
        try:
            if(t["data-exterior"]=="Not Available"):
                continue
            name.append(t["data-hashname"])
            id_parse=requests.get(f"http://steamcommunity.com/market/listings/730/{name[-1]}")
            item_id=getid(id_parse.text)
            skin_ids[name[-1]]=item_id
            sleep(3)
        except:
            sleep(60)
            #i want to reiterate now

我想你想要一个
试试:。。。catch:
在整个
循环中,而不是在上面显示的循环中…我很确定,try catch在正确的位置。如果我把它放在外面,它将永远运行,直到它可以通过整个循环。对不起,我的错误。