码迷,mamicode.com
首页 > 编程语言 > 详细

函数解析——python学习第二次总结

时间:2019-09-11 11:31:58      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:字符串   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. """
源码

 

函数解析——python学习第二次总结

标签:字符串   real   play   sele   字符串类型   类型   char   com   *args   

原文地址:https://www.cnblogs.com/zhuqt-2008/p/11505135.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!