Re: Better way to replace/remove characters in a list of strings.

2006-09-05 Thread Marc 'BlackJack' Rintsch
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

Re: Better way to replace/remove characters in a list of strings.

2006-09-05 Thread George Sakkis
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

Re: Better way to replace/remove characters in a list of strings.

2006-09-05 Thread Chris Brat
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

Re: Better way to replace/remove characters in a list of strings.

2006-09-04 Thread Bruno Desthuilliers
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. --

Re: Better way to replace/remove characters in a list of strings.

2006-09-04 Thread Chris Brat
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 >

Re: Better way to replace/remove characters in a list of strings.

2006-09-04 Thread George Sakkis
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

Re: Better way to replace/remove characters in a list of strings.

2006-09-04 Thread Philipp Pagel
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

Better way to replace/remove characters in a list of strings.

2006-09-04 Thread Chris Brat
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