Python uses regular expressions will some English text cut word list

Python uses regular expressions will some English text cut into a list of words, syntax is:

re.split(r"\b[\.,\s\n\r\n]+?\b",str)

code show as below:

import re
str=''I still have it on my note 3 and holding pretty good,
 I have also dropped my phone about 3 times 
and the case has done it's job, so I am very happy with the case, 
plus it feels very nice on the hand, 
and I like that the camera don't touch the outside anymore. 
happy customer here..''

if __name__ == '__main__':
    word_list=re.split(r"\b[\.,\s\n\r\n]+?\b",str)
    for word in word_list:
        print word

 

Guess you like

Origin www.cnblogs.com/shenxiaolin/p/12551526.html