关于 'list' object has no attribute 'select'

我是在写爬虫是遇到了这个问题: 

c = chapter.select('href')
AttributeError: 'list' object has no attribute 'select'

这是我的代码:

chapter = soup.select('ul._chapter > li > a')
c = chapter.select('href')

原因: select 返回的是一个列表list, 而list是没有select方法的. 所以用不了.

解决办法,换正则,详见: https://blog.csdn.net/qq_41684261/article/details/86627580

转载于:https://www.cnblogs.com/DSYR/p/10314788.html

你可能感兴趣的:(关于 'list' object has no attribute 'select')