函数解析——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. """
源码

猜你喜欢

转载自www.cnblogs.com/zhuqt-2008/p/11505135.html