# -*-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
python正则表达式将字符串切割成单词列表
最新推荐文章于 2023-03-14 23:46:40 发布