easy way to remove nonprintable chars from string
Isaac Raway
isaac at blueapples.org
Thu Jul 24 16:04:15 EDT 2003
This seems to work. Not sure how fast it'd be, though.
def stripNoPrint(str):
results = ""
for char in str:
if string.printable.find(char):
results += char
return results
Don Hiatt wrote:
>Greetings,
>
>Is there an easy way to remove multiple non-printable
>(e.g. "not strings.printable") from a string? Perhaps
>something like foo.replace(list_of_nonprintables, '')
>if it only existed? :-)
>
>Cheers,
>
>don
>
>
More information about the Python-list
mailing list