python正则表达式将字符串切割成单词列表
2017-07-19 14:33
274 查看
# -*-coding:utf-8-*- import re str='''I like to read novel books. When I start to go to primary school, my parents have bought me a lot of novel books, because they want me to fall in love with reading. Indeed, thanks to these books, I feel very excited about studying the knowledge. The novel books open my vision and I am good at writing. I want to write a book and read them to my families and friends.''' if __name__ == '__main__': word_list=re.split(r"\b[\.,\s\n\r\n]+?\b",str) for word in word_list: print word
相关文章推荐
- Java - 华为机试训练 - 【中级】单词倒排(正则表达式切割字符串)
- python读配置文件;正则表达式替换、切割字符串;获取当前时间
- 用python正则表达式提取字符串
- 正则表达式-2(字符串切割)+(字符串按正则表达式替换)
- C#中切割字符串之正则表达式应用
- python中使用正则表达式匹配出字符串中的数字
- “黑马成序员”正则表达式例题“将字符串按爹词且割,输出切割后的字符串和字符串的个数”
- python字符串及正则表达式[转]
- python字符串与正则表达式
- Python正则表达式如何进行字符串替换
- Python使用中文正则表达式匹配指定中文字符串的方法示例
- python中从字符串中获得单词列表
- 正则表达式 切割字符串 split()方法的运用
- 收集: python中列表,元组,字符串 相互转换, IO 数据处理,行数据切割
- python核心编程-正则表达式之-匹配多个字符串
- Python字符串及正则表达式
- 用正则表达式找出不包含连续字符串abc的单词
- python爬虫主要就是五个模块:爬虫启动入口模块,URL管理器存放已经爬虫的URL和待爬虫URL列表,html下载器,html解析器,html输出器 同时可以掌握到urllib2的使用、bs4(BeautifulSoup)页面解析器、re正则表达式、urlparse、python基础知识回顾(set集合操作)等相关内容。
- Python判断字符串是否符合某一正则表达式
- 用正则表达式找出不包含连续字符串abc的单词