Answer the question
In order to leave comments, you need to log in
How to remove escape characters in Python?
Guys, tell me please.
Got a line with escape characters /n etc. Is there any method how to remove this case, or only through a loop with conditions? Sorry for the stupid question, I can't find anything in the manual.
Answer the question
In order to leave comments, you need to log in
Maybe the replace method will help? Replace "\n" with ""
Is that what was meant?
>>> import re
>>> ss = 'aaa\\nbbb\\tccc'
>>> re.sub('\\\\.', ss, '\\$')
'aaa\nbbb\tccc'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question