1
$\begingroup$

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.

$\endgroup$

closed as off-topic by m_goldberg, Henrik Schumacher, Bob Hanlon, Szabolcs, José Antonio Díaz Navas Jan 8 at 22:00

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, Henrik Schumacher, Bob Hanlon, Szabolcs, José Antonio Díaz Navas
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 5
    $\begingroup$ Have you tried Get["file.txt"]? $\endgroup$ – J. M. is slightly pensive Jan 6 at 13:31
  • $\begingroup$ I am an idiot. It worked, tnx. $\endgroup$ – uuu Jan 6 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 at 0:43

Browse other questions tagged or ask your own question.