Method of ignoring case in Python string comparison

1. Regular expression, use the IGNORECASE flag

>>> import re
>>> m = re.search('multi', 'A mUltiCased string', re.IGNORECASE)
>>> bool(m)

2.
converts two strings to the same uppercase before comparing, using upper() or lowercase,lower()

>>> s = 'A mUltiCased string'.lower()
>>> s
'a multicased string'
>>> s.find('multi')
2


Read More: