BeautifulSoup: Can't convert NavigableString to string
I tried to decode when I should have encoded:
str(child.encode('utf-8'))
You can do this:
unicode(tag.string)
For Python 3, the answer is merely
str(tag.string)
Other answers will fail.
unicode()
is not a built-in in Python 3.
tag.string.encode('utf-8')
will convert the string to a byte string, which you don't want..