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?
rstripis the wrong method because it will look at".txt", and understand it as something like['.', 't', 'x', 't']aka "keep removing characters that matches those in that list until you reach a character that is not in that list. - neverendingqs