您的位置:首页 > 编程语言 > Python开发

Data Analysis学习笔记 --- Python数据清洗对字符串处理

2017-04-13 10:50 671 查看


# -*- coding:utf-8 -*-
str = 'i like apple, i like bananer'

#split by ','
print(str.split(','))

#split by ' '
print(str.split(' '))

#find index
print(str.index(','))

#find index
print(str.find(','))

#count char
print(str.count('i'))

#use replace and split
print(str.replace(',', '').split(' '))


结果:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: