0
$\begingroup$

This is probably a simple-minded question, but I've tried many things that haven't worked. In the output below, how does one add a line break before "points=..."? It will also need to work in PutAppend.

iter=3;
points={{0,0},{2,6},{0,6},{5,7}};
Print["iter=", iter, "points=", points]
$\endgroup$
3
  • 1
    $\begingroup$ ..."\npoints="... $\endgroup$
    – Kuba
    May 16 '19 at 9:07
  • $\begingroup$ This works for Print but unfortunately not for PutAppend. $\endgroup$
    – Friasco
    May 16 '19 at 10:39
  • $\begingroup$ PutAppend["test", "this", "C:/temp/temp.txt"] $\endgroup$
    – Alan
    May 16 '19 at 12:54
0
$\begingroup$

Perhaps this will be close enough to what you want.

iter = 3;
points = {{0, 0}, {2, 6}, {0, 6}, {5, 7}};
tmp = StringTemplate["``=``"]
Do[Print[tmp[s, ToExpression@s]], {s, {"iter", "points"}}]
Do[PutAppend[tmp[s, ToExpression@s], "C:/temp/temp.txt"], {s, {"iter", "points"}}]
$\endgroup$
1
  • $\begingroup$ Thanks, that works. Sometimes I pine for the simplicity of Fortran-like I/O. $\endgroup$
    – Friasco
    May 17 '19 at 4:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.