最佳答案
I have a bunch of strings, some of them have ' rec'. I want to remove that only if those are the last 4 characters.
So in other words I have
somestring = 'this is some string rec'
and I want it to become
somestring = 'this is some string'
What is the Python way to approach this?