Python efficent non cases sensitive match? [duplicate]

  python, python-3.x

In python to check if ‘apple’ appears in another string we do:

if 'apple' in my_str:

To check without cases sensitive I read we can do:

if 'apple' in my_str.lower():

But what if my_str is REALLY long, it’s not efficent to call .lower() on it… Doesn’t python support native non cases sensitive match?

Source: Python-3x Questions

LEAVE A COMMENT