字符串的简单替换:
>>> s='welldone'
>>> s.replace('ll','11')
'we11done'
格式化高级替换
>>> '%s is %s' % ('TaiWan','China')
'TaiWan is China'
>>> '{0} is {1}'.format('TaiWan','China')
'TaiWan is China'
字符串的简单替换:
>>> s='welldone'
>>> s.replace('ll','11')
'we11done'
格式化高级替换
>>> '%s is %s' % ('TaiWan','China')
'TaiWan is China'
>>> '{0} is {1}'.format('TaiWan','China')
'TaiWan is China'