how to use find command in python for case insensitive search

convert the original string and the substring to lowercase using the lower() method before performing the search. As a result, the find() method returns the correct index even though the case of the substring doesn’t match the original string.

if text.lower().find('flyer') >= 0:
            height = 1024
            width = 512
        elif text.lower().find('poster') >= 0:
            height = 512
            width = 1024 

Discover more from Soa Technology | Aditya Website Development Designing Company

Subscribe to get the latest posts sent to your email.



Leave a Reply

Discover more from Soa Technology | Aditya Website Development Designing Company

Subscribe now to keep reading and get access to the full archive.

Continue reading