≈ the.bay.news

Why doesn't str.strip work as I expect?

Discussions on Python.org
Why doesn't str.strip work as I expect?
A beginner who should have asked this here, opened a tracker issue thinking that " ##Python## ".lstrip(' #') should produce "Python## ". In other words, that lstrip always deletes leading whitespace and that the optional chars argument adds to whitespace instead of replacing default whitespace. I repeat below an edited version my answer there. Use interactive help() to get the answer below. >>> help(str.lstrip) Help on method descriptor lstrip: lstrip(self, chars=None, /) unbound builtins...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.