1

I'm attempting to read a desired line terminator from a configuration file.

If the parsing were working the way I want, the output from print(val) would be a blank line, and print(repr(val)) would print '\r' because val would contain a carriage return character. Instead print(val) outputs \r and print(repr(val)) outputs '\\r', which I understand means val contains a backslash character and a 'r' character.

How do I convert from a string that contains literal representations of escape sequences to one that contains the characters those escape sequences represent?

poompt
  • 248
  • 1
  • 8

0 Answers0