I have a string s
, and I want to remove '.mainlog'
from it. I tried:
>>> s = 'ntm_MonMar26_16_59_41_2018.mainlog'
>>> s.strip('.mainlog')
'tm_MonMar26_16_59_41_2018'
Why did the n
get removed from 'ntm...'
?
Similarly, I had another issue:
>>> s = 'MonMar26_16_59_41_2018_rerun.mainlog'
>>> s.strip('.mainlog')
'MonMar26_16_59_41_2018_reru'
Why does python insist on removing n
's from my strings? How I can properly remove .mainlog
from my strings?