0

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.

1

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

BeautifulSoup actually uses lxml now (optionally), and lxml can handle invalid XML!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.