python字符串函数

str.capitalize(self)        首字母变大写        返回值:    S.capitalize() -> string

str.count(self, sub, start=None, end=None        子序列个数        返回值:       S.count(sub[, start[, end]]) -> int

str.decode(self, encoding=None, errors=None)        解码        返回值:    S.decode([encoding[,errors]]) -> object

str.encode(self, encoding=None, errors=None)        编码,针对unicode        返回值:    S.encode([encoding[,errors]]) -> object

str.endswith(self, suffix, start=None, end=None)        是否以 xxx 结束        返回值:S.endswith(suffix[, start[, end]]) -> bool

str.expandtabs(self, tabsize=None)        将tab转换成空格,默认一个tab转换成8个空格        返回值:    S.expandtabs([tabsize]) -> string

str.find(self, sub, start=None, end=None)        寻找子序列位置,如果没找到,返回 -1        返回值:    S.find(sub [,start [,end]]) -> int

str.format(*args, **kwargs):        字符串格式化,动态参数        返回值:    S.format(*args, **kwargs) -> string

str.index(self, sub, start=None, end=None)        子序列位置,如果没找到,报错        返回值:    S.index(sub [,start [,end]]) -> int

str.isalnum(self)        是否是字母和数字        返回值:    S.isalnum() -> bool

str.isalpha(self)         是否是字母        返回值:    S.isalpha() -> bool

str.isdigit(self)        是否是数字        返回值:    S.isdigit() -> bool

str.islower(self)        是否小写        返回值:    S.islower() -> bool

str.isspace(self)                                  返回值:    S.isspace() -> bool

str.istitle(self)                                       返回值:    S.istitle() -> bool

str.isupper(self)                                 返回值:    S.isupper() -> bool

str. join(self, iterable)         连接        返回值:      S.join(iterable) -> string

str. ljust(self, width, fillchar=None):         内容左对齐,右侧填充        返回值:     S.ljust(width[, fillchar]) -> string

str. lower(self):        变小写         返回值:    S.lower() -> string

str. lstrip(self, chars=None)        移除左侧空白        返回值:    S.lstrip([chars]) -> stringor unicode

str.partition(self, sep)        分割,前,中,后三部分        返回值:    S.partition(sep) -> (head, sep, tail)

str.replace(self, old, new, count=None)        替换            返回值:    S.replace(old, new[, count]) -> string

str.rfind(self, sub, start=None, end=None)                返回值:         S.rfind(sub [,start [,end]]) -> int

str. rindex(self, sub, start=None, end=None)            返回值:         S.rindex(sub [,start [,end]]) -> int

str.rjust(self, width, fillchar=None)                返回值:        S.rjust(width[, fillchar]) -> string

str.rpartition(self, sep):                            返回值:        S.rpartition(sep) -> (head, sep, tail)

str.rsplit(self, sep=None, maxsplit=None)            返回值:        S.rsplit([sep [,maxsplit]]) -> list of strings

str.rstrip(self, chars=None)                返回值:        S.rstrip([chars]) -> stringor unicode

str.split(self, sep=None, maxsplit=None)        分割, maxsplit最多分割几次        返回值:       S.split([sep [,maxsplit]]) -> list of strings

str.splitlines(self, keepends=False)            根据换行分割            返回值:       S.splitlines(keepends=False) -> list of strings

str.startswith(self, prefix, start=None, end=None)        是否起始        返回值:       S.startswith(prefix[, start[, end]]) -> bool

str.strip(self, chars=None)        移除两段空白            返回值:       S.strip([chars]) -> stringor unicode

str.swapcase(self)        大写变小写,小写变大写        返回值:        S.swapcase() -> string

str.title(self)                                                                    返回值:        S.title() -> string

str.translate(self, table, deletechars=None)            转换,需要先做一个对应表,最后一个表示删除字符集合 

                                                                                        返回值:       S.translate(table [,deletechars]) -> string

str.center(self, width, fillchar=None)        内容居中,width:总长度;fillchar:空白处填充内容,默认无        

                                                                        返回值:    S.center(width[, fillchar]) -> string

str. upper(self)                                                            返回值:        S.upper() -> string

str.zfill(self, width)        方法返回指定长度的字符串,原字符串右对齐,前面填充0。        返回值:        S.zfill(width) -> string


def _formatter_field_name_split(self, *args, **kwargs): # real signature unknown

        pass

def _formatter_parser(self, *args, **kwargs): # real signature unknown

        pass

def __add__(self, y): 

        """x.__add__(y) <==> x+y"""        pass 

def __contains__(self, y): 

        """x.__contains__(y) <==> yinx"""        pass

def __eq__(self, y): 

        """x.__eq__(y) <==> x==y"""        pass

def __format__(self, format_spec): 

        """        S.__format__(format_spec) -> string

def __getattribute__(self, name): 

        """x.__getattribute__('name') <==> x.name"""        pass

def __getitem__(self, y): 

        """x.__getitem__(y) <==> x[y]"""        pass

def __getnewargs__(self, *args, **kwargs): # real signature unknown

        pass

    def __getslice__(self, i, j): 

        """        x.__getslice__(i, j) <==> x[i:j]

    def __ge__(self, y): 

        """x.__ge__(y) <==> x>=y"""        pass

    def __gt__(self, y): 

        """x.__gt__(y) <==> x>y"""        pass

    def __hash__(self): 

        """x.__hash__() <==> hash(x)"""        pass

    def __init__(self, string=''): # known special case of str.__init__

        """        str(object='') -> string


        Return a nice string representation of the object.

        If the argument isa string, thereturnvalueis the same object.

        # (copied from class doc)"""        pass

    def __len__(self): 

        """x.__len__() <==> len(x)"""        pass

    def __le__(self, y): 

        """x.__le__(y) <==> x<=y"""        pass

    def __lt__(self, y): 

        """x.__lt__(y) <==> x

    def __mod__(self, y): 

        """x.__mod__(y) <==> x%y"""        pass

    def __mul__(self, n): 

        """x.__mul__(n) <==> x*n"""        pass

    @staticmethod # known case of __new__

    def __new__(S, *more): 

        """T.__new__(S, ...) -> a new object with type S, a subtype of T"""        pass

    def __ne__(self, y): 

        """x.__ne__(y) <==> x!=y"""        pass

    def __repr__(self): 

        """x.__repr__() <==> repr(x)"""        pass

    def __rmod__(self, y): 

        """x.__rmod__(y) <==> y%x"""        pass

    def __rmul__(self, n): 

        """x.__rmul__(n) <==> n*x"""        pass

    def __sizeof__(self): 

        """S.__sizeof__() -> size of Sinmemory,inbytes"""        pass

    def __str__(self): 

        """x.__str__() <==> str(x)"""        pass

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,524评论 5 460
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,869评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,813评论 0 320
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,210评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,085评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,117评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,533评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,219评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,487评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,582评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,362评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,218评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,589评论 3 299
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,899评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,176评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,503评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,707评论 2 335