Skip to content
Related Articles
Open in App
Not now

Related Articles

Python String casefold() Method

Improve Article
Save Article
  • Difficulty Level : Medium
  • Last Updated : 22 Aug, 2022
Improve Article
Save Article

Python String casefold() method is used to convert string to lower case. It is similar to lower() string method, but case removes all the case distinctions present in a string.

Python String casefold() Method Syntax

Syntax:  string.casefold()

Parameters: The casefold() method doesn’t take any parameters.

Return value: Returns the case folded string the string converted to lower case.

Python String casefold() Method Example


print("lowercase string: ", string.casefold())


lowercase string: geeksforgeeks

Python String lower() vs casefold()


string = "ß"
print("Using lower():", string.lower())
print("Using casefold():", string.casefold())


Using lower(): ß
Using casefold(): ss

Explanation: Python String casefold() Method is more aggressive in conversion to lower case characters because it tends to remove all case distinctions in a String.

Practical Example using Python String casefold() Method

Here, we have a Python string with characters of mixed cases. We are using Python String casefold() Method to convert everything to lowercase.


string = "WeightAGE oF THe DiScuSSiON"
print("Original String:", string)
# print the string after casefold transformation
print("String after using casefold():", string.casefold())


Original String: WeightAGE oF THe DiScuSSiON
String after using casefold(): weightage of the discussion

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!