-1

I am trying to compare two string and ignore case- sensitive but i don't want to use .lower() or .upper(). Is there another way of doing this?

Doron Shevach
  • 133
  • 1
  • 11

1 Answers1

1
example1 = "hello"
example2 = "HeLlo"

if example1.casefold()==example2.casefold():
    #do something

This will work without needing upper() or lower(). Might not work for non-ASCII characters.

Ahmet
  • 434
  • 4
  • 13