I\'m starting to learn Python and I\'ve decided to code a simple scraper. One problem I\'m encountering is I cannot convert a NavigableString to a regular string.
U
For Python 3, the answer is merely str(tag.string)
str(tag.string)
Other answers will fail.
unicode() is not a built-in in Python 3.
unicode()
tag.string.encode('utf-8') will convert the string to a byte string, which you don't want..
tag.string.encode('utf-8')