Is it possible to use the python command rstrip
so that it does only remove one exact string and does not take all letters separately?
I was confused when this happened:
>>>"Boat.txt".rstrip(".txt")
>>>'Boa'
What I expected was:
>>>"Boat.txt".rstrip(".txt")
>>>'Boat'
Can I somehow use rstrip and respect the order, so that I get the second outcome?
question from:https://stackoverflow.com/questions/18723580/python-rstrip-one-exact-string-respecting-order