strip() method makes me confused

Bischoop Bischoop at vimart.net
Sat Nov 7 06:03:50 EST 2020


According to documentation strip method removes heading and trailing
characters.

Why then:

txt = ",,,,,rrttggs...,..s,bananas...s.rrr"

x = txt.strip(",s.grt")

print(x)

output: banana

another example:

text = "this is text, there should be not commas, but as you see there
are still"
y = txt.strip(",")
print(text)

output: 
this is text, there should be not commas, but as you see there are still





More information about the Python-list mailing list