python - i am unable to scrap the phone number . Can anyone help me -
here html content of part.
<p class="contact-info " onclick="_ct('clntphn', 'lspg');"> <i class="contactno spriteimg"></i> <span><a><b>+(91)-80-30805680</b></a></span> </p>
i have tried extracting by:
soup.find('p',{'class':'contact-info'})
but in vain . unable same.
you can use find
method tag:
from bs4 import beautifulsoup soup s = soup(html_data, "lxml") number = s.find('b').text
output:
u'+(91)-80-30805680'
to first instance, can try this:
new_s = s.findall("p", {"class":"contact-info"}) new_data = [i.text in new_s] print(new_data[0].replace("\n", ''))
output:
+(91)-80-30805680
Comments
Post a Comment