codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

strip() method makes me confused


On 2020-11-07, Frank Millman <frank at chagford.com> 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)
>>>
>>> output:
>>> this is text, there should be not commas, but as you see there are still
>>>
>> 
>
> P.S. If you wanted to remove all the commas, you could do it like this -
>
> y = txt.replace(',', '')
>
>

I understand now what is happening thanks. Yes, I know about replace, it
just was bothering me about those examples I've gave earlier. Thanks