string replace

Schüle Daniel uval at rz.uni-karlsruhe.de
Fri Jun 30 10:12:51 EDT 2006


> A solution could be that "replace" accept a tuple/list of chars, like
> that was add into the new 2.5 for startswith.
> 
> I don't know, but can be this feature included into a future python 
> release?

I don't know, but I think it would be useful

as for now I use this

 >>> import re
 >>> chars = re.compile(r'[abc]')
 >>> text = "aAbBcCdD"
 >>> chars.sub("",text)
'ABCdD'
 >>>

> 
> Thanks,
> Michele

Regards, Daniel



More information about the Python-list mailing list