I am having a problem using the Print[] statement to print out CSV file contents and various strings. I don’t understand why this code prints out the data in the order shown below. I would have expected the code to:
1) Insert “Here 2 ------------------------------“ after the 1st printed row that contains 3,c
2) Insert “Here 3 ------------------------------“ after the 2nd printed row that contains 3,c
3) Insert “Here 4 ------------------------------“ after the 3rd printed row that contains 3,c
Instead the code prints out the CSV file contents 3 times, and then inserts the Here 2, Here 3 and Here 4 strings at the end of the print out. Is this how Mathematica was designed to behave, or am I doing something wrong and/or misunderstanding something?
1) Insert “Here 2 ------------------------------“ after the 1st printed row that contains 3,c
2) Insert “Here 3 ------------------------------“ after the 2nd printed row that contains 3,c
3) Insert “Here 4 ------------------------------“ after the 3rd printed row that contains 3,c
Instead the code prints out the CSV file contents 3 times, and then inserts the Here 2, Here 3 and Here 4 strings at the end of the print out. Is this how Mathematica was designed to behave, or am I doing something wrong and/or misunderstanding something?
In[]:=
Print["Here 1 ------------------------------"]FilePrint["TF.csv"]Print["Here 2 ------------------------------"]FilePrint["TF.csv"]Print["Here 3 ------------------------------"]FilePrint["TF.csv"]Print["Here 4 ------------------------------"]
Here 1 ------------------------------
1,A
2,B
3,C
1,A
2,B
3,C
1,A
2,B
3,C
2,B
3,C
1,A
2,B
3,C
1,A
2,B
3,C
Here 2 ------------------------------
Here 3 ------------------------------
Here 4 ------------------------------