human
What is a good Python function to remove non-printing characters.
assistant
Here is a Python function to remove non-printing characters

import re

def remove_non_printing(string):
    """Remove non printing characters from a string"""
    return re.sub(r'[^\x20-\x7f]', '', string)

# Enter the string
string = "This is a string with non printing characters"

# Calling the function
print((remove_non_printing(string)))

#Example Output
# This is a string with non printing characters

#Remember to inspect code for bugs.