I am learning beautiful soup in Python.
I am trying to parse a simple web page with a list of books.
eg
<a href="https://www.nostarch.com/carhacking">The Car Hacker's Handbook</a>
I am using the code below.
import requests, bs4 res = requests.get('http://nostarch.com') res.raise_for_status() nSoup = bs4.BeautifulSoup(res.text,"html.parser") elems = nSoup.select('.product-body a')
and
But I want the correct text to be set,
s = elems[0].getText() print s >>>The Car Hacker's Handbook
How do I change my code to give a "Guide for Car Hackers" instead of "u'The Car Hacker \ u2019s Handbook"?
Please help.
source share