码迷,mamicode.com
首页 > 编程语言 > 详细

Python——字符串的内建方法

时间:2017-07-30 13:58:18      阅读:232      评论:0      收藏:0      [点我收藏+]

标签:seq   strip   swap   字母   end   rip   python   title   大小   

(仅部分)

string.strip():去除字符串首尾指定字符,默认为space

string.lstrip()     string.rstrip():去掉字符串左边     右边的空格

string.split(str):以str为分隔符切片string

string.join(seq):以string作为分隔符,将seq中的元素合并为一个新的字符串

string.startswith(obj,beg=0,end=len(string)):检查字符串开头是否是obj,返回值为布尔值。如果有beg和end,在指定范围内检查

string.swapcase():翻转string中的大小写

string.title():标题化的string,首字母大写

Python——字符串的内建方法

标签:seq   strip   swap   字母   end   rip   python   title   大小   

原文地址:http://www.cnblogs.com/zhaoxiaoyu/p/7258395.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!