替换字符 replace
_string = 'hello world'
new_string = _string.replace('hello', 'world')
print(new_string)
删除字符串后三位
now=datetime.datetime.now().isoformat()
print(now,type(now))
now = now.replace(now[-3:],'')
print(now)
替换字符 replace
_string = 'hello world'
new_string = _string.replace('hello', 'world')
print(new_string)
删除字符串后三位
now=datetime.datetime.now().isoformat()
print(now,type(now))
now = now.replace(now[-3:],'')
print(now)