python-3.x - 在dict中重新迭代for循环
问题描述
每次服务器禁止我的 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
解决方案
推荐阅读
- python - 如何将 3D 数组的 python 列表转换为特定形状的单个 3D 数组?
- c - 如何将二维用户输入的数组从函数传递到 main()?
- serverless-framework - 具有 API 网关、Lambda 层和 Webpack 的无服务器框架(配置地狱)
- javascript - JavaScript - 在 ECharts 中显示带有字典的条形图
- function - 函数并从输入中分配 10 个随机数
- c# - 用于识别负数和正数偶数/奇数的代码不起作用
- google-sheets-formula - 如何在谷歌表上将多个复杂的 IF 语句组合成一个查询/公式?
- android - Live Data Observer On 按钮 屏幕旋转时单击
- flutter - 如何简化此辅助功能?
- debugging - BrowserSync 在 Laradock 中不起作用(使用 laravel-mix)