【发布时间】:2018-11-01 06:31:05
【问题描述】:
我的 html 代码中有一个类。我需要使用 python 定位 td 类“Currentlocation”。
代码:
<td class="CURRENTLOCATION"><img align="MIDDLE" src="..\Images\FolderOpen.bmp"/> Metrics</td>
以下是我尝试过的代码。
第一次尝试:
My_result = page_soup.find_element_by_class_name('CURRENTLOCATION')
出现“TypeError: 'NoneType' object is not callable”错误。第二次尝试:
My_result = page_soup.find(‘td’, attrs={‘class’: ‘CURRENTLOCATION’})
得到“标识符中的无效字符”错误。
谁能帮我在 html 代码中使用 python 找到一个类?
【问题讨论】:
标签: python html python-3.x web-scraping data-extraction