首页 > IT职业 > IT图书 > Python字符串操作函数整理
upper()
>>> name="Super Python"
>>> print(name.upper())
SUPER PYTHON lower()
>>> name="Super Python"
>>> print(name.lower())
super python title()
>>> name="abc def gh"
>>> print(name.title())
Abc Def Gh 字符串删除空白操作 rstrip()
>>> str=" abc "
>>> print(str.rstrip())
abc lstrip()
>>> str=" abc "
>>> print(str.lstrip())
abc strip()
>>> str=" abc "
>>> print(str.strip())
abc 字符串类型转换 str()
>>> age=23
>>> msg="我的年龄:"+str(age)
>>> print(msg)
我的年龄:23 文章持续更新中……
本文后续会随着知识的积累不断补充和更新,内容如有错误,欢迎指正。
最后一次更新时间:2018-06-22
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/212/viewspace-2802864/ ,如需转载,请注明出处,否则将追究法律责任。