Python字符串的方法

获取

    S.count(sub[, start[, end]]) -> int

    S.find(sub[, start[, end]]) -> int

    S.rfind(sub[, start[, end]]) -> int

    S.index(sub[, start[, end]]) -> int

    S.rindex(sub[, start[, end]]) -> int

    S.partition(sep) -> (head, sep, tail)

    S.rpartition(sep) -> (head, sep, tail)

    S.split(sep=None, maxsplit=-1) -> list of strings

    S.rsplit(sep=None, maxsplit=-1) -> list of strings

    S.splitlines([keepends]) -> list of strings

判断

    S.endswith(suffix[, start[, end]]) -> bool

    S.startswith(prefix[, start[, end]]) -> bool

    S.isalnum() -> bool

    S.isalpha() -> bool

    S.isdigit() -> bool

    S.isdecimal() -> bool

    S.isnumeric() -> bool

    S.isidentifier() -> bool

    S.islower() -> bool

    S.isupper() -> bool

    S.istitle() -> bool

    S.isprintable() -> bool

    S.isspace() -> bool

转换

    S.capitalize() -> str

    S.casefold() -> str

    S.lower() -> str

    S.swapcase() -> str

    S.upper() -> str

    S.title() -> str

    S.center(width[, fillchar]) -> str

    S.ljust(width[, fillchar]) -> str

    S.rjust(width[, fillchar]) -> str

    S.zfill(width) -> str

    S.expandtabs(tabsize=8) -> str

    S.format(*args, **kwargs) -> str

    S.format_map(mapping) -> str

    S.join(iterable) -> str

    S.strip([chars]) -> str

    S.lstrip([chars]) -> str 

    S.rstrip([chars]) -> str

    S.replace(old, new[, count]) -> str

阅读更多
文章标签: Python 字符串
个人分类: Python
想对作者说点什么? 我来说一句

Python入门

python入门

zjy1040028623 zjy1040028623

2017-09-05 21:27:05

阅读数:61

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭