The lstrip()
function doesn't behave in exactly the way you think it might. x.lstrip(argument)
removes any of the characters in argument
from the left of the string x
until it reaches a character not in argument
.
So 'KEY_K'.lstrip('KEY_')
generates ''
because the last character, K
, is in KEY_
.