Python BeautifulSoup [解决方法] TypeError: list indices must be integers or slices n
在python的Beautiful Soup 4 扩展库的使用过程中出现了 TypeError: list indices must be integers or slices, not str 这个错误,这里就分析一下为什么会报错以及如何解决。 这个错误的意思是’类型错误:list的索引必须是’integers’或者’slices’不能是’str’ 我出现错误的代码: #引入库 from bs4 import BeautifulSoup #读取页面 soup = BeautifulSoup(open('index.html')) #获取标签 img_tag = div.select(
下载地址
用户评论