Possible Duplicate:
python .rstrip removes one additional character
What is the problem here? it seems that rstrip removes more than necessary in the one to the last line of code.
s = 'LedArray.py'
s.rstrip('y')
'LedArray.p'
s.rstrip('py')
'LedArray.'
s.rstrip('.py')
'LedArra'
s.rstrip('y.py')
'LedArra'
rstriptakes “characters to remove”, not “exact substring to remove” argument..pyandy.pyare equivalent as sets. In fact, you could doy.pand it’d still remove the same characters.