python - finding all Strong tags with beautifulsoup returns an empty array -


i want extract strings included in strong tags , save them in file. cannot extract strong tags; returns empty array. missing anything. here code have used: input:

>>>import requests >>>from bs4 import beautifulsoup >>>r=requests.get(' http://www.webmd.com/heart-disease/heart-disease-glossary#1') >>>r.content >>> soup=beautifulsoup(r.content,"lxml") >>>print(soup) >>>soup.find_all('strong') 

output last statement:

[] 

thanks,

actually, there isn't strong tag in soup.

when open url in browser, can 2 strong tags. don't think need them.

<li xmlns="http://www.w3.org/1999/xhtml">check address typing errors such <strong>ww</strong>.example.com instead of <strong>www</strong>.example.com</li> 

if mean terms in bold, should use .find_all('b').

[tag.text.strip().replace(':',"") tag in soup.find_all('b')] 

outputs:

['ablation','advance directive (living will)','aerobic exercise', ...] 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -