CKTIS / Python
str.strip
Z obeh koncev odstrani bele znake ali posamične znake iz neobveznega chars.
Različica: Python 3.14; repository image, production runtime not attested
Sintaksa
s.strip(chars=None, /)Z obeh koncev odstrani bele znake ali posamične znake iz neobveznega chars.
Pri xy odstrani vse robne x in y, zato ostane data.
Presledek znotraj mid dle ostane, saj ni na robu.
assert "xy x y yx".strip("xy ") == "" and " x y ".strip() == "x y"
Primeri
print("xydataxy".strip("xy"))
print(" mid dle ".strip())
Rezultat
data mid dle
Presledek znotraj mid dle ostane, saj ni na robu.