"Lad" <[EMAIL PROTECTED]> top posted:
> > re's are a pain. Do this instead:
> >
> > >>> s = "hello, goodbye,boo"
> > >>> s.replace(', ',',')
> > 'hello,goodbye,boo'
> > >>> _.replace(',',', ')
> > 'hello, goodbye, boo'
> Thank you for ALL for help.
> Hendrik,
> your solution works great but
>
Nick Craig-Wood wrote:
> Lad <[EMAIL PROTECTED]> wrote:
> > In a text I need to add a blank(space) after a comma but only if
> > there was no blank(space) after the comman If there was a
> > blank(space), no change is made.
> >
> > I think it could be a task for regular expression but can not
Lad kirjoitti:
>
> Thank you for ALL for help.
> Hendrik,
> your solution works great but
> what is `_` in
> _.replace(',',', ')
>
> for?
When you are trying things out in the Python shell IDLE, _ is a
shorthand way to use the last value printed by IDLE.
Thus when
s.replace(', ',',')
p
"Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote:
> From: "Lad" <[EMAIL PROTECTED]> wrote:
>
>
>> In a text I need to
>> add a blank(space) after a comma but only if there was no blank(space)
>> after the comman
>> If there was a blank(space), no change is made.
>>
>> I think it could be a task f
Lad <[EMAIL PROTECTED]> wrote:
> In a text I need to add a blank(space) after a comma but only if
> there was no blank(space) after the comman If there was a
> blank(space), no change is made.
>
> I think it could be a task for regular expression but can not
> figure out the correct regular e
Thank you for ALL for help.
Hendrik,
your solution works great but
what is `_` in
_.replace(',',', ')
for?
Thank you
La.
> re's are a pain. Do this instead:
>
> >>> s = "hello, goodbye,boo"
> >>> s.replace(', ',',')
> 'hello,goodbye,boo'
> >>> _.replace(',',', ')
> 'hello, goodbye, boo'
> >>>
From: "Lad" <[EMAIL PROTECTED]> wrote:
> In a text I need to
> add a blank(space) after a comma but only if there was no blank(space)
> after the comman
> If there was a blank(space), no change is made.
>
> I think it could be a task for regular expression but can not figure
> out the correct re
Lad wrote:
> In a text I need to
> add a blank(space) after a comma but only if there was no blank(space)
> after the comman
> If there was a blank(space), no change is made.
>
> I think it could be a task for regular expression but can not figure
> out the correct regular expression.
> Can anyon
Lad wrote:
> In a text I need to
> add a blank(space) after a comma but only if there was no blank(space)
> after the comman
> If there was a blank(space), no change is made.
>>> s = "alpha, beta,gamma, delta"
>>> ", ".join(t.replace(",", ", ") for t in s.split(", "))
'alpha, beta, gamma, delta
In a text I need to
add a blank(space) after a comma but only if there was no blank(space)
after the comman
If there was a blank(space), no change is made.
I think it could be a task for regular expression but can not figure
out the correct regular expression.
Can anyone help, please?
Thank you
L.
10 matches
Mail list logo