unicode_stop
import unicodedata
def unicode_stop(text):
"""Removes all unicode control characters from a string."""
control_characters = [c for c in text if unicodedata.combining(c) or unicodedata.iscontrol(c)]
return ''.join(ch for ch in text if ch not in control_characters)
print(unicode_stop('This is a test string with some control characters.'))Last updated