human
how to get the last part of a string before a certain character?
assistant
Here is some code to get the last part of a string before the character '-'

print(x.rsplit('-', 1)[0])

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.