Python ButifulSoup 去杂质 去除DIV 里面的其他元素的内容

 比如,这里,如果直接:

 step = i.find('div', class_='recipeStep_word').text

会带上序号 1

如果不需要序号,需要改成

  step =  [s for s in i.find('div', class_='recipeStep_word')][1]

猜你喜欢

转载自blog.csdn.net/Allure_LoveU/article/details/121452152