I am trying to scrape from the <span class= ''>
using python. The code looks like this on the pages I am scraping:
<li class="item">
<span class="name">Sara</span>
<span class="value">selling potato in town</span>
</li>
<li class="item">
<span class="name">Grouping</span>
<span class="value">clothes</span>
</li>
<li class="item">
<span class="name">Phone</span>
<span class="value">
04142018071 09128983727
</span>
</li>
What I need to get are "Sara" and "selling potato in town" and "Phone" and " 04142018071 09128983727 " Can you help me?
I try the following code:
for stng1 in soup.find_all('li', class_='item'):
for stng in stng1.find_all('span'):
#print (stng)
if stng.has_attr("class"):
if stng['class'] == 'name':
print (stng.string)