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

Chris Brat chrisBrat at gmail.com
Mon Sep 4 12:26:38 CEST 2006


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 = ["abbbb","123a","nnnnas"]

for i, v in enumerate(x) :
    x[i] = v.replace("a","b")


This works, but I'd like to know peoples opinions.

Thanks
Chris




More information about the Python-list mailing list