##以匹配符号切割list import re s = 'afd4afagf4dgsh'b = re.split('4', s)print(b)#['afd', 'afagf', 'dgsh'] ##以匹配符号切割,在以符号连接成str import re s = 'afd4afagf4dgsh'b = re.sub('4', '*', s)print(b)#afd*afagf*dgsh 来源:https://www.cnblogs.com/chenlulu1122/p/11888655.html 标签 正则