Help on class str in module __builtin__:
class str(basestring)
| str(object='') -> string
|
| Return a nice string representation of the object.
| If the argument is a string, the return value is the same object.
|
| Method resolution order:
| str
| basestring
| object
|
| Methods defined here:
|
| __add__(...)
| x.__add__(y) <==> x+y #字符串拼接,看+号就知道
|
| __contains__(...)
| x.__contains__(y) <==> y in x #判断x里字符是否在y里
|
| __eq__(...)
| x.__eq__(y) <==> x==y
|
| __format__(...)
| S.__format__(format_spec) -> string
|
| Return a formatted version of S as described by format_spec.
|
| __ge__(...)
| x.__ge__(y) <==> x>=y
|
| __getattribute__(...)
| x.__getattribute__('name') <==> x.name #获取属性
|
| __getitem__(...)
| x.__getitem__(y) <==> x[y] #索引取值,详情参考python中的序列
|
| __getnewargs__(...)
|
| __getslice__(...)
| x.__getslice__(i, j) <==> x[i:j] #切片,也是序列的一种方法
|
| Use of negative indices is not supported.
|
| __gt__(...)
| x.__gt__(y) <==> x>y
|
| __hash__(...)
| x.__hash__() <==> hash(x)
|
| __le__(...)
| x.__le__(y) <==> x<=y
|
| __len__(...)
| x.__len__() <==> len(x)
|
| __lt__(...)
| x.__lt__(y) <==> x<y
|
| __mod__(...)
| x.__mod__(y) <==> x%y
|
| __mul__(...)
| x.__mul__(n) <==> x*n
|
| __ne__(...)
| x.__ne__(y) <==> x!=y
|
| __repr__(...)
| x.__repr__() <==> repr(x)
|
| __rmod__(...)
| x.__rmod__(y) <==> y%x
|
| __rmul__(...)
| x.__rmul__(n) <==> n*x
|
| __sizeof__(...)
| S.__sizeof__() -> size of S in memory, in bytes #用字节表示在内存中的大小
|
| __str__(...)
| x.__str__() <==> str(x)
|
| capitalize(...)
| S.capitalize() -> string
| '''返回首字母大写字符串副本,对中文无效'''
| Return a copy of the string S with only its first character
| capitalized.
|
| center(...)
| S.center(width[, fillchar]) -> string
| '''返回指定宽度(width)的字符串副本,原字符串居中对齐,可指定用什么来填充多余部分(fillchar)默认为空格,关于对齐和填充可以看上篇博文的解释'''
| Return S centered in a string of length width. Padding is
| done using the specified fill character (default is a space)
|
| count(...)
| S.count(sub[, start[, end]]) -> int
| '''计数器,返回给定字符串在原字符串出现的次数,也可指定范围'''
| Return the number of non-overlapping occurrences of substring sub in
| string S[start:end]. Optional arguments start and end are interpreted
| as in slice notation.
|
| decode(...)
| S.decode([encoding[,errors]]) -> object
| '''解码,将字符串解码成某种字符集'''
| Decodes S using the codec registered for encoding. encoding defaults
| to the default encoding. errors may be given to set a different error
| handling scheme. Default is 'strict' meaning that encoding errors raise
| a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'
| as well as any other name registered with codecs.register_error that is
| able to handle UnicodeDecodeErrors.
|
| encode(...)
| S.encode([encoding[,errors]]) -> object
| '''编码,将字符串编码'''
| Encodes S using the codec registered for encoding. encoding defaults
| to the default encoding. errors may be given to set a different