I know that new line is classically made by "\n".
I want to make a string with lines of data and then export it into a file:
outString = StringJoin["First Line \nSecond Line"]
Put[outString, NotebookDirectory[] <> "testOut.txt"]
The first line, make a decent output in the Mathematica itself:
"First Line
Second Line"
But in the testOut.txt file , it is :
"First Line \nSecond Line"
Note that it even includes the quotation marks and both in the same line ! What is the solution for that ?



WriteString+1 – Mr.Wizard Apr 23 '15 at 23:31WriteStream. – kglr Apr 23 '15 at 23:46WriteStringlong expression. WriteString by default writes expression(string) as a single line. – BabaYaga Jan 13 '21 at 22:11WriteString. You can use WriteLine instead. – kglr Jan 14 '21 at 17:48String. But I needed for some different purpose. I am writing a big expression in the formdouble var = exprfor which I findWriteStringconvenient so far with only problem is that it writes the expression (Text) in a single line. May be I will open a new thread on this. – BabaYaga Jan 14 '21 at 18:00