First, fix the unmatched quotes in the last part of exp.
exp = {"I do not", "understand", "this"}
Use Riffle to insert a linebreak in between each part, and then use
StringJoin to combine into a single string.
withbreaks=Riffle[exp, "\n"]
text=StringJoin[withbreaks]
Export["filename.txt", text]
I like to use SetDirectory[NotebookDirectory[]]
before importing/exporting, so that the directory is the same place
where the working notebook is saved.
On 6/11/2013 2:22 AM, Francisco Gutierrez wrote:
> Friends:
>
> Suppose I have a string variable, say:exp={"I do not", "understand", this"}
> I want to export this variable to a text file, so that each part of exp is separated by a line (\n). Thus I want to get:I do notunderstandthis
>
> How can I achieve this? Thanks
>
> Francisco
>
>