[英]How can I solve this error?(python crawling)
I have been crawling Flickr data for 2 weeks.我一直在抓取 Flickr 数据 2 周。 Crawling has been done well.
爬行做得很好。 But, today executing the python code in Windows PowerShell, this error happened.
但是,今天在 Windows PowerShell 中执行 python 代码时,发生了这个错误。
Traceback (most recent call last): File "getdata_tag.py", line 3 in module
nsid= info["owner"]["nsid"];
TypeError: string indices must be integers, not str
how can I modify this code?我该如何修改此代码? I will add the code here
我会在这里添加代码
This looks like info["owner"]
or info
itself is string, not dictionary.这看起来像
info["owner"]
或info
本身是字符串,而不是字典。
You must check which scenario is it and then remove ["owner"]["nsid"]
if info
is string or only ["nsid"]
if info["owner"] is string.您必须检查它是哪种情况,然后删除
["owner"]["nsid"]
如果info
是字符串,或者只有["nsid"]
如果 info["owner"] 是字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.