In[70]:=
{ 2, 3, 5, 7, 11, 13, 17, 19,23}>> primefile
will create a file called primefile where the list will be stored. This can be
read into
any expression using the ReadList command.
In[71]:=
primes= ReadList[ "primefile", Expression]
Out[71]
Notice that this has placed an extra set of braces around the input. The
extra
In[72]:=
Out[72]
To add to a file we can use the PutAppend command or its short form,
>>>.
In[73]:=
In[74]:=
set of braces can be removed using the Flatten command, which removes all
the
braces (except the outermost ones) from a list.
primes= Flatten[ primes]
{ 29, 31, 37, 41, 43, 47} >>> primefile
primes= Flatten[ ReadList[ "primefile", Expression]]