Python Convert String to Lowercase

May 30, 2019
value = u'Hello'.lower()

For case insensitive comparison, you might want to use str.casefold.

Return a casefolded copy of the string. Casefolded strings may be used for caseless matching.

Casefolding is similar to lowercasing but more aggressive because it is intended to remove all case distinctions in a string. For example, the German lowercase letter ‘ß’ is equivalent to “ss”. Since it is already lowercase, lower() would do nothing to ‘ß’; casefold() converts it to “ss”.

New in version 3.3.

email_casefold = email.casefold()

NOTE: Casefold support for Python 2.x

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.