Re: strip() method makes me confused

2020-11-07 Thread Bischoop
On 2020-11-07, Alexander Neilson wrote: > Because the strip methods argument is the set of characters to remove from > either end. So it checks from the ends character by character until it finds > a character that isn’t in the set. Then it removes everything prior to that > (or after that at e

Re: strip() method makes me confused

2020-11-07 Thread Bischoop
On 2020-11-07, Frank Millman wrote: > On 2020-11-07 1:28 PM, Frank Millman wrote: >> On 2020-11-07 1:03 PM, Bischoop wrote: >>> > [...] >>> >>> another example: >>> >>> text = "this is text, there should be not commas, but as you see there >>> are still" >>> y = txt.strip(",") >>> print(text) >>>

Re: strip() method makes me confused

2020-11-07 Thread Frank Millman
On 2020-11-07 1:28 PM, Frank Millman wrote: On 2020-11-07 1:03 PM, Bischoop wrote: [...] 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

Re: strip() method makes me confused

2020-11-07 Thread Frank Millman
On 2020-11-07 1:03 PM, Bischoop wrote: According to documentation strip method removes heading and trailing characters. Both are explained in the docs - Why then: txt = ",rrttggs...,..s,bananas...s.rrr" x = txt.strip(",s.grt") print(x) output: banana "The chars argument is not a p

Re: strip() method makes me confused

2020-11-07 Thread Alexander Neilson
Because the strip methods argument is the set of characters to remove from either end. So it checks from the ends character by character until it finds a character that isn’t in the set. Then it removes everything prior to that (or after that at end of the string) and then returns the result.

strip() method makes me confused

2020-11-07 Thread Bischoop
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.