如何在Python的BeautifulSoup/Selenium中编写跳过空白td的for循环
我刮的来源是外汇工厂 有一个包含表行和表数据的表 但是,有些表数据没有值,因为它们是演讲或事件 <>我如何编写一个for循环条件来过滤掉空白的TD值。 这是一个空白的表数据标记。如何在Python的BeautifulSoup/Selenium中编写跳过空白td的for循环,python,selenium,xpath,beautifulsoup,Python,Selenium,Xpath,Beautifulsoup,我刮的来源是外汇工厂 有一个包含表行和表数据的表 但是,有些表数据没有值,因为它们是演讲或事件 我如何编写一个for循环条件来过滤掉空白的TD值。 这是一个空白的表数据标记。 for row in table.find_all('tr', {'data-eventid':True}): list_of_cells = [] #Filtering out High-Impact events and copy its URL link for span in row.find_all('span
for row in table.find_all('tr', {'data-eventid':True}):
list_of_cells = []
#Filtering out High-Impact events and copy its URL link
for span in row.find_all('span', class_='high'):
直接获取要查找的事件ID(高影响事件、非空值)的XPath解决方案: 只需在URL末尾添加ID:
https://www.forexfactory.com/calendar.php#detail=
你完成了
https://www.forexfactory.com/calendar.php#detail=