stripping out unwanted characters in string

Johannes Stezenbach yawyi at gmx.de
Mon Jun 5 07:02:57 EDT 2000


Jerry F. Davis <jfdecd at execpc.com> wrote:
>I have a string that has some unwanted characters in it.
>Octal 240 for instance.
>
>I want to actually strip them out of my string.
>
>I have looked at string.replace, but can't seem to figure out how to do
>this.

table = string.maketrans("", "")
sOut = string.translate(sIn, table, "\240")

Johannes




More information about the Python-list mailing list