函数解析——python学习第二次总结
Posted zhuqt-2008
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了函数解析——python学习第二次总结相关的知识,希望对你有一定的参考价值。
.str 字符串类型
1. capitalize 首字母大写
示例:
1 a = ‘alex‘ 2 v = a.capitalize() 3 print(v)
# 输出
# Alex
源码:
1 def capitalize(self, *args, **kwargs): # real signature unknown 2 """ 3 Return a capitalized version of the string. 4 5 More specifically, make the first character have upper case and the rest lower 6 case. 7 """
2. casefold 字符串对应字符变小
示例:
1 a = ‘ALEx‘ 2 v = a.casefold() 3 print(v)
# 输出
# alex
源码:
1 def casefold(self, *args, **kwargs): # real signature unknown 2 """ Return a version of the string suitable for caseless comparisons. """
以上是关于函数解析——python学习第二次总结的主要内容,如果未能解决你的问题,请参考以下文章