I appologise in advance if this was asked before, but I couldn't find the answer.

I have a huge amount of data collected in several lists that I need to analyse. I don't want to have all this data listed in my actual Mathematica file, because it would take an enormous amount of space in my notebook. Rather, I want to save it in an external .txt file and somehow import it. The .txt file is of a form:

a={1, 2, 3, 4};
b={5, 6, 7, 8};
c={9, 10, 11, 12};

and I am looking for a way to read it and evaluate it in the notebook without actually writing it down. I want to be able to then do operations on a, b, and c as if they were part of the notebook from the beginning.

  • 5
    $\begingroup$ Have you tried Get["file.txt"]? $\endgroup$ – J. M. is in limbo Jan 6 '19 at 13:31
  • $\begingroup$ I am an idiot. It worked, tnx. $\endgroup$ – uuu Jan 6 '19 at 13:42
  • $\begingroup$ This should be saved as a .wl file if it is a bunch of Wolfram Language code. $\endgroup$ – GenericAccountName Jan 7 '19 at 0:43

Browse other questions tagged or ask your own question.