Deleting characters from a string

Hrvoje Niksic hniksic at srce.hr
Sat Jun 5 12:43:27 EDT 1999


aahz at netcom.com (Aahz Maruch) writes:

> In article <87n1ye3g4v.fsf at pc-hrvoje.srce.hr>,
> Hrvoje Niksic  <hniksic at srce.hr> wrote:
> >
> >What I would really like to be able to do is write:
> >
> >  host = string.translate(host, None, ' "')
> >
> >Am I missing a more elegant solution?
> 
> I dunno, but I'd tend to use re.sub().

I should have made it clear, sorry.  I don't want want to import re
because I don't need it anywhere else in my program.  It's even less
elegant and probably much slower than string.translate() anyway.




More information about the Python-list mailing list