string.rstrip() is removing extra characters

Viewed 2784

Why does this statement remove the 'E' in 'PIPELINE':

In: 'PIPELINE_DEV'.rstrip('_DEV')
Out: 'PIPELIN'

But this statement does not remove the 'S':

In: 'PIPELINES_DEV'.rstrip('_DEV')
Out: 'PIPELINES'

This statement removes all of the E's at the end:

In: 'PIPELINEEEEEEEE_DEV'.rstrip('_DEV')
Out: 'PIPELIN'

When I turn the rstrip into 2 separate statements, it works fine:

In: 'PIPELINE_DEV'.rstrip('DEV').rstrip('_')
Out: 'PIPELINE'
1 Answers
Related