python split 通过多个字符分割
代码:
import re
a = "Hello world!How are you?My friend.Tom"
re.split(" |!|?|.", a)
答案:
['Hello', 'world', 'How', 'are', 'you', 'My', 'friend', 'Tom']
代码:
import re
a = "Hello world!How are you?My friend.Tom"
re.split(" |!|?|.", a)
答案:
['Hello', 'world', 'How', 'are', 'you', 'My', 'friend', 'Tom']