Python strings built-in function operation examples and source code analysis
发布时间
阅读量:
阅读量
#coding=utf8
'''
下面列出目前字符串内建支持的方法,所有这些方法都包含了对Unicode的支持,
一些甚至是专门用于Unicode的。
----------------------------------------------------------------------------
string.capitalize() :
把字符串的第一个字符大写
9. string.center(width):
返回一个原字符串居中,
并使用空格填充值长度width的新字符串
13. string.count(str,beg=0, end=len(string)) :
返回str在string里面出现的次数,
如果beg或者end指定则返回指定范围内str出现的次数
17. string.decode(encoding="utf8", errors="strict"):
以encoding指定的编码格式解码string,
如果默认报一个ValueError的异常,
除非errors指定的是'ignore'或者'replace'
22. st
全部评论 (0)
还没有任何评论哟~
