def rchop(s, suffix):
if suffix and s.endswith(suffix):
return s[:-len(suffix)]
return s
somestring = 'this is some string rec'
rchop(somestring, ' rec') # returns 'this is some string'
def rchop(s, suffix):
if suffix and s.endswith(suffix):
return s[:-len(suffix)]
return s
somestring = 'this is some string rec'
rchop(somestring, ' rec') # returns 'this is some string'