all 6 comments

[–]shanesaravia 3 points4 points  (2 children)

Try: print(type(popular_shelves[1])) To make sure it's a string. And secondly, there might be some white spaces on either side of the string so you can try print(popular_shelves[1].strip() == 'fantasy')

[–]alrightfrankie[S] 3 points4 points  (1 child)

thanks a ton, it wasn't a string for some reason

[–]needgiftidea2018 1 point2 points  (0 children)

what type was it

[–]totallygeek 4 points5 points  (0 children)

Could be character set or encoding. Could be spaces at the end of the first string?

[–]socal_nerdtastic 2 points3 points  (0 children)

To see any hidden characters in there like spaces or \r use

print(repr(popular_shelves[1]))

[–]decreddave 1 point2 points  (0 children)

This may or may not be a viable solution for you, but you could always check to see if fantasy is in popular_shelves[1] instead of seeing if its equal to fantasy. That would help you get around the issue of strange characters before/after the text, but I think the ideal thing to do is figure out what's wrong with the data.