strip()
用法:移除字符串中首尾的指定字符串。
注意:出现在中间的字符串不会被移除;如果没有出现指定的字符串,也不会报错。
'1d1ccd111'.strip('1')
output: 'd1ccd'
'1d1ccd111'.strip('2')
output: '1d1ccd111'
strip()
用法:移除字符串中首尾的指定字符串。
注意:出现在中间的字符串不会被移除;如果没有出现指定的字符串,也不会报错。
'1d1ccd111'.strip('1')
output: 'd1ccd'
'1d1ccd111'.strip('2')
output: '1d1ccd111'