easy way to remove nonprintable chars from string

Skip Montanaro skip at pobox.com
Thu Jul 24 16:00:01 EDT 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.

Skip





More information about the Python-list mailing list