In <[EMAIL PROTECTED]>, George Sakkis
wrote:
> Chris Brat wrote:
>
>> Wouldn't this only cause problems with large lists - for once off
>> scripts with small lists it doesn't seem like a big issue to me.
>
> The extra memory to allocate the new list is usually a minor issue; the
> important one i
Chris Brat wrote:
> Hi
>
> Wouldn't this only cause problems with large lists - for once off
> scripts with small lists it doesn't seem like a big issue to me.
>
> Regards,
> Chris
>
> Bruno Desthuilliers wrote:
> > Chris Brat a écrit :
> > > Thanks, thats exactly what I was looking for - very nea
Hi
Wouldn't this only cause problems with large lists - for once off
scripts with small lists it doesn't seem like a big issue to me.
Regards,
Chris
Bruno Desthuilliers wrote:
> Chris Brat a écrit :
> > Thanks, thats exactly what I was looking for - very neat.
> >
> Just note that both solutions
Chris Brat a écrit :
> Thanks, thats exactly what I was looking for - very neat.
>
Just note that both solutions rebind the name to a newly constructed
list instead of modifying the original list in place. This is usually
the RightThing(tm), but sometimes one wants an in-place modification.
--
Thanks, thats exactly what I was looking for - very neat.
George Sakkis wrote:
> Philipp Pagel wrote:
>
> > Chris Brat <[EMAIL PROTECTED]> wrote:
> > > Is there a better way to replace/remove characters (specifically ' and
> > > " characters in my case, but it could be anything) in strings in a
>
Philipp Pagel wrote:
> Chris Brat <[EMAIL PROTECTED]> wrote:
> > Is there a better way to replace/remove characters (specifically ' and
> > " characters in my case, but it could be anything) in strings in a
> > list, than this example to replace 'a' with 'b':
>
> x = map(lambda foo: foo.replace('a
Chris Brat <[EMAIL PROTECTED]> wrote:
> Is there a better way to replace/remove characters (specifically ' and
> " characters in my case, but it could be anything) in strings in a
> list, than this example to replace 'a' with 'b':
x = map(lambda foo: foo.replace('a', 'b'), x)
cu
Philipp
Hi,
Is there a better way to replace/remove characters (specifically ' and
" characters in my case, but it could be anything) in strings in a
list, than this example to replace 'a' with 'b':
x = ["a","123a","as"]
for i, v in enumerate(x) :
x[i] = v.replace("a","b")
This works, bu