python中casefold()方法,转换字符串大小写
casefold()方法描述
casefold()方法,是python内置的字符串方法之一,可以将字符串对象中的所有大写的字母转换成相应的小写字母。
casefold()方法参数
无参数,通过str.casefold()的方式进行调用;传递参数python会抛出TypeError
casefold()方法返回值
将调用casefold()方法的字符串对象中的存在的大写字母转换成相应的小写字母,并以该新的字符串进行返回,并不修改原来的字符串;
casefold()方法实例代码
>>> str = 'This Is An Python Casefold Example.'
>>> str.casefold()
'this is an python casefold example.'
>>> str #str字符串的值并为被修改
'This Is An Python Casefold Example.'