1、replace替换
>>> import re
>>> a=‘123456‘
>>> pattern=re.findall(r‘.*?5‘,a)[0]
>>> a.replace(pattern,‘‘)
‘67‘
时间: 2024-10-16 17:15:56
1、replace替换
>>> import re
>>> a=‘123456‘
>>> pattern=re.findall(r‘.*?5‘,a)[0]
>>> a.replace(pattern,‘‘)
‘67‘