Home > Blockchain >  Finding a substring despite lowecases and upper cases in python
Finding a substring despite lowecases and upper cases in python

Time:10-02

Assume I have the following string:

mystring = "my eMaIL address is [email protected]"

I would like to be able to find its position on the string. I know that if I use this, I will get it.

pos = mystring.find("eMaIL")

But I was wondering if it's possible to get the same result using:

pos = mystring.find ("email")

Thank you all :)

CodePudding user response:

You can use .lower() like this:

pos = mystring.lower().find ("email")
  • Related