Split string of re module of python3 advanced regular expression

print ( ' abc ' .split( '  ' ))
 print (re.split(r ' \s+ ' , ' abc ' ))
 print (re.split(r ' [\s\,\;]+ ' , ' a ,b;; cd ' ))
 #Note the position of the + sign #Output : 
# ['a', 'b', '', '', 'c'] 
# ['a', 'b', 'c' ] 
# ['a', 'b', 'c', 'd']


 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324805257&siteId=291194637