I want to remove all types of escape sequences from a list of strings. How can I do this? input:
[\'william\', \'short\', \'\\x80\', \'twitter\', \'\\xaa\',
The following worked for me in Python 3.6:
word = '\t\t\t\t\t\ntest\t msg' filter = ''.join([chr(i) for i in range(1, 32)]) word.translate(str.maketrans('', '', filter))
Output:
'test msg'
Source here