📜  多分割python代码示例

📅  最后修改于: 2022-03-11 14:46:03.024000             🧑  作者: Mango

代码示例1
str = 'Lorem; ipsum. dolor sit amet, consectetur adipiscing elit.'
str = str.split(',')
print(str) # Output ['Lorem; ipsum. dolor sit amet', ' consectetur adipiscing elit.']

import re
str = 'Lorem; ipsum. dolor sit amet, consectetur adipiscing elit.'
str = re.split(r';|,|\.', str)
print(str) # Output ['Lorem', ' ipsum', ' dolor sit amet', ' consectetur adipiscing elit', '']