标签:字符串 real play sele 字符串类型 类型 char com *args
.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. """
标签:字符串 real play sele 字符串类型 类型 char com *args
原文地址:https://www.cnblogs.com/zhuqt-2008/p/11505135.html