0

I'm writing a script in Python that parses text from a file. One thing I need is to be able to read two chars that make up an escape char, like \ and n -> '\n'. So basically, how can I take a string "\" and combine it with "n" to become the escape char "\n"?

Thanks in advance.

EDIT: Solved in another question: Process escape sequences in a string in Python

Thanks for the help!

Joseph Long
  • 241
  • 1
  • 3
  • 12
  • There are a few different ways you could do that, and the most appropriate one depends on the case. What kind of text/file is it? Is it a standard format, like JSON or source code in some language? – Ry- Aug 28 '20 at 14:51
  • Standard text file. This here is the solution: https://stackoverflow.com/questions/4020539/process-escape-sequences-in-a-string-in-python – Joseph Long Aug 28 '20 at 18:54

0 Answers0