代码有什么问题?Python3.6

时间:2018-07-16 14:44:23

标签: python-3.x

我无法弄清楚这两个代码有什么问题。我找不到任何区别。

for id,level,sex,content,laugh,comment in zip(ids,levels,sexs.contents,laughs,comments):

这有效。.

for id,level,sex,content,laugh,comment in zip(ids,levels,sexs,contents,laughs,comments):

失败。.

  

回溯(最近通话最近):
    
中的文件“ G:/ pachong /爬虫/re_crawl.py”,第43行       get_info(url)
    在get_info
中,文件“ G:/ pachong /爬虫/re_crawl.py”,第28行       用于zip中的id,级别,性别,内容,笑,注释(id,level,sexs.contents,笑,注释):
  AttributeError:“列表”对象没有属性“内容”

1 个答案:

答案 0 :(得分:1)

您不小心输入了句点(.)而不是逗号(,)。 Python将其视为对sexs对象的属性查找。只需将sexs.contents更改为sexs,contents

相关问题