miércoles, 2 de diciembre de 2020

Convert a string to a raw string in Python

The situation is the following:

1. I retrieve a string from a server and store it in a variable. 

2. The string contains newline characters ( \n )

3. I want to store the string in a file (as it is)

4. The new line characters are stored as new lines in the resulting file


So, how do I store the RAW string in a file?

And that is it! Hope it helps