字符串对象方法
split()方法拆分字符串:
![](https://images.cnblogs.com/cnblogs_com/sirkevin/866601/o_ch07-c-0.png)
strip()方法去掉空白符和换行符:
![](https://images.cnblogs.com/cnblogs_com/sirkevin/866601/o_ch07-c-1.png)
split()结合strip()使用:
![](https://images.cnblogs.com/cnblogs_com/sirkevin/866601/o_ch07-c-2.png)
"+"符号可以将多个字符串连接起来:
![](https://images.cnblogs.com/cnblogs_com/sirkevin/866601/o_ch07-c-3.png)
join()方法也是连接字符串,比较它和"+"符号的区别:
![](https://images.cnblogs.com/cnblogs_com/sirkevin/866601/o_ch07-c-4.png)
in关键字判断一个字符串是否包含在另一个字符串中:
![](https://images.cnblogs.com/cnblogs_com/sirkevin/866601/o_ch07-c-5.png)
index()方法和find()方法判断一个子字符串的位置:
![](https://images.cnblogs.com/cnblogs_com/sirkevin/866601/o_ch07-c-6.png)
index()方法和find()方法的区别是:如果不包含子字符串,index()会抛出一个异常,而find()会返回-1。
count()方法判断子字符串出现的次数:
![](https://images.cnblogs.com/cnblogs_com/sirkevin/866601/o_ch07-c-7.png)
replace()方法替换子字符串:
![](https://images.cnblogs.com/cnblogs_com/sirkevin/866601/o_ch07-c-8.png)
正则表达式
使用正则表达式一般的操作分为三类:匹配、替换和拆分。
匹配
![](https://images.cnblogs.com/cnblogs_com/sirkevin/866601/o_ch07-c-9.png)
替换
![](https://images.cnblogs.com/cnblogs_com/sirkevin/866601/o_ch07-c-10.png)
拆分
![](https://images.cnblogs.com/cnblogs_com/sirkevin/866601/o_ch07-c-11.png)
pandas中矢量化的字符串函数
![](https://images.cnblogs.com/cnblogs_com/sirkevin/866601/o_ch07-c-12.png)