Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Python的BeautifulSoup/Selenium中编写跳过空白td的for循环_Python_Selenium_Xpath_Beautifulsoup - Fatal编程技术网

如何在Python的BeautifulSoup/Selenium中编写跳过空白td的for循环

如何在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循环条件来过滤掉空白的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', class_='high'):

直接获取要查找的事件ID(高影响事件、非空值)的XPath解决方案:

只需在URL末尾添加ID:

https://www.forexfactory.com/calendar.php#detail=
你完成了

https://www.forexfactory.com/calendar.php#detail=