如何实现python中lower函数?
如何实现python中lower函数?
之前小编介绍过python中将字符串小写字符转为大写的upper函数的使用方法(upper函数)。有将小写转为大写的需要,那也有将大写转为小写的情况。本文主要介绍在python中可以将字符串大写自摸转换为小写字母的lower函数。
1、lower()
转换字符串中所有大写字符为小写
2、语法
str.lower()->str
3、返回值
返回将字符串中的所有大写字母转换为小写字母的字符串
4、使用实例
#!/usr/bin/python3
str="ABCDEFG"
print(str.lower())
输出
abcdefg
以上就是python中lower函数的介绍,如果需要将字符串中个的大写转为小写,可以使用lower函数哦,还是很方便的。更多Python学习教程请关注IT培训机构:千锋教育。

相关推荐HOT
更多>>
python正则表达式中的零宽断言
python正则表达式中的零宽断言1、概念有些元字符不匹配任何字符,只是简单的表示成功或失败,所以这些字符也叫零宽断言。2、符号举例(1)|或操作...详情>>
2023-11-14 11:35:03
python方法的绑定和未绑定
python方法的绑定和未绑定1、说明未绑定对象的方法:无self参数的方法,通过定义类调用函数,返回未绑定self的方法。绑定对象的方法:带self参...详情>>
2023-11-14 09:53:02
python海象运算符的使用
python海象运算符的使用1、在判断条件下允许操作。在一定程度上简化了代码,但降低了可读性。i=len((l:=[1,2,3]))#先对l进行赋值,在对i赋值whi...详情>>
2023-11-14 02:38:21
pythonelif语句报错是什么原因
python的else和elif语句也可以叫做子句,因为它们不能独立使用,两者都是出现在if、for、while语句内部的。else子句可以增加一种选择;而elif子...详情>>
2023-11-13 21:46:35热门推荐
技术干货






