Say I have a string str="abc\n\ndef"
and I want to write it to a file in a single line as it is. I use file.write(str)
, however, the new lines will be expanded and the file will be something like
abc
def
Is there a way I could write it into a single line?