I can strip numerics but not alpha characters:
>>> text
\'132abcd13232111\'
>>> text.strip(\'123\')
\'abcd\'
Why the followi
Just to add a few examples to Jim's answer, according to .strip() docs:
So it doesn't matter if it's a digit or not, the main reason your second code didn't worked as you expected, is because the term "abcd" was located in the middle of the string.
Example1:
s = '132abcd13232111'
print(s.strip('123'))
print(s.strip('abcd'))
Output:
abcd
132abcd13232111
Example2:
t = 'abcd12312313abcd'
print(t.strip('123'))
print(t.strip('abcd'))
Output:
abcd12312313abcd
12312313