As far as I know, the most pythonic/efficient method would be:
import string filtered_string = filter(lambda x: x in string.printable, myStr) Note: string.printable - String of ASCII characters which are considered printable.
Here is example for unicode:
def remove_non_printable(value: str) -> str: return ''.join(i for i in value if i.isprintable())