One way to check if string contains text:
text = 'somewhere over the rainbow'
keyword = 'Rainbow'
if keyword.lower() in str(text).lower():
print 'yes, it is'
Is there a shorter way?
One way to check if string contains text:
text = 'somewhere over the rainbow'
keyword = 'Rainbow'
if keyword.lower() in str(text).lower():
print 'yes, it is'
Is there a shorter way?
You can use the find() method:
if text.lower().find(keyword.lower()) != -1:
print 'yes, it is'