我正在尝试理解Python中的string.strip()方法是做什么的:
In [35]: t1 = '-MIN-North'
In [36]: t1.strip('-MIN-')
Out[36]: 'orth'
In [37]: t2 = '-MIN-north'
In [38]: t2.strip('-MIN-')
Out[38]: 'north'
为什么t1.strip('-MIN-')
不等于'North'
,但是t2.strip('-MIN-')
等于'north'
?
t1.replace('-MIN-','')
。 - sacuL