likelukeyo
likelukeyo

Reputation: 51

Get HTML values in python

I am kinda new to python so please cut me some slack. I have a webpage that has a specific tag that I would like to get the value from. Is there some sort of python library I can use to get the value of that tag? Thank you.

Upvotes: 0

Views: 50

Answers (1)

user4600699
user4600699

Reputation: 1485

If it is valid xml, you can use xml.etree.ElementTree. If not, the preferrable way to deal with html is BeautifulSoup

import BeautifulSoup
soup = BeautifulSoup.BeautifulSoup(your)
print soup.find('span')[0].contents

Something like that i believe

Upvotes: 1

Related Questions