【已解决】AttributeError: ‘str‘ object has no attribute ‘items‘
报错信息:上面的问题其实很简单,意思是说str类型没有items属性,而items属性是字典的属性。此处是因为headers本应为dict,实际传入了str。修改建议:# head = 'Mozilla/5.0'head = {'User-Agent': 'Mozilla/5.0'}修改后再次运行就不再报错:...
·
报错信息:
上面的问题其实很简单,意思是说str类型没有items属性,而items属性是字典的属性。
此处是因为headers本应为dict,实际传入了str。修改建议:
# head = 'Mozilla/5.0'
head = {'User-Agent': 'Mozilla/5.0'}
修改后再次运行就不再报错:
更多推荐
所有评论(0)