Deleting characters from a string

Hrvoje Niksic hniksic at srce.hr
Sat Jun 5 15:56:32 CEST 1999


string.translate can delete characters from a string, as well as
translate them.  But what if I want *only* to delete them?  Currently
I do this:

dummytable = string.maketrans('', '')

...
  host = string.translate(host, dummytable, ' "')
...

What I would really like to be able to do is write:

  host = string.translate(host, None, ' "')

Am I missing a more elegant solution?




More information about the Python-list mailing list