easy way to remove nonprintable chars from string

Skip Montanaro skip at pobox.com
Thu Jul 24 22:00:01 CEST 2003

    Don> Is there an easy way to remove multiple non-printable (e.g. "not
    Don> strings.printable") from a string? Perhaps something like
    Don> foo.replace(list_of_nonprintables, '') if it only existed? :-)

Check out the string module's translate function.


More information about the Python-list mailing list