Why do some characters in the string disappear inexplicably after using strip() method in python3?

41 Views Asked by At

The specific code is as follows

input = "Please convert 899999999999 using AaBbCcDdEeFfGgHhIiJjKkaaaaLlaaa "
output = input.strip('Please convert')

print(output)

899999999999 using AaBbCcDdEeFfGgHhIiJjKkaaaaL

Can anyone give an explanation?

1

There are 1 best solutions below

0
OneCricketeer On

strip() removes all lead and end characters taken from the given string, not the literal input provided

https://docs.python.org/3/library/stdtypes.html#str.strip

In other words, 'acelnorstvP ' would yield the same output