When I run the following code:
if substr in movie.lowercase:
I get the following error
AttributeError: 'NavigableString' object has no attribute 'lowercase'
movie is from here:
movie = row.td.div.h4.string
I tried to change it to (without success)
movie = row.td.div.h4.string.string
or
movie = unicode(row.td.div.h4.string)
Do you know how to convert NavigableString to normal unicode string with lowercase method?
unicode()doesn’t have.lowercase()method it has.lower().NavigableStringis an instance ofunicode. It has allunicodemethods.A case-insensitive search is more complicated then just calling
.lower()e.g. full unicode casefolding in Python (case-insensitive search for keywords).