IndexError: list index out of range
来源:14-12 获取和解析详情页 - 1

朗月清风
2019-06-13
all_divs = sel.xpath("//div[starts-with(@id, ‘post-’)]")
all_divs取不到值
执行到 topic_item = all_divs[0] 就会报 IndexError: list index out of range
又遇到同样问题的吗?还请指导,谢谢了
写回答
1回答
-
你在运行这个代码之前打印一下返回的html,先确定一下html中是否有这个元素的存在
012019-06-27
相似问题