Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #14822
| From | Helen Read <readhpr@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: a trivial task? |
| Date | 2013-06-12 09:26 +0000 |
| Message-ID | <kp9eso$2tb$1@smc.vnet.net> (permalink) |
| References | <kp6fm8$nct$1@smc.vnet.net> |
| Organization | Time-Warner Telecom |
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
>
>
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
a trivial task? Francisco Gutierrez <fgutiers2002@yahoo.com> - 2013-06-11 06:22 +0000 Re: a trivial task? Helen Read <readhpr@gmail.com> - 2013-06-12 09:26 +0000
csiph-web