热线电话:13121318867

登录
2020-11-11 阅读量: 5338
python出现 'list' object has no attribute 'text'怎么办

bb=[[],

[<selenium.webdriver.remote.webelement.WebElement (session="53973fd1a118e8dbba1359c6c7e8fae3", element="07fc80a6-9a0e-411f-8368-c610c56f19dd")>],

[<selenium.webdriver.remote.webelement.WebElement (session="53973fd1a118e8dbba1359c6c7e8fae3", element="0a847793-85f3-4cb5-97d3-83f9bb72a0a1")>],

[<selenium.webdriver.remote.webelement.WebElement (session="53973fd1a118e8dbba1359c6c7e8fae3", element="7ba42195-f1d6-4b59-9191-d11eb5456190")>]]

在运行

hh=[]

for i in bb:

b=i.text

hh.append(b)时出现以下错误:

AttributeError                            Traceback (most recent call last)<ipython-input-20-1c26df9350c8> in <module>      1 hh=[]      2 for i in bb:----> 3     b=i.text      4     hh.append(b)AttributeError: 'list' object has no attribute 'text'


解决办法:1、删除空值 del bb[0]

2、降维dd=np.array(bb[1:]).ravel()

32.6576
0
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子