If you want to save Mathematica symbols and variables, it might be better to save DumpSave
, as in
SetDirectory[NotebookDirectory[]];
lst = {{{1, 2}, {4, 5}}, {5}, {1, 2, 3, 4}};
DumpSave["foo.mx", lst];
Clear[lst];
Get["foo.mx"];
lst
(* {{{1, 2}, {4, 5}}, {5}, {1, 2, 3, 4}} *)
You can also use "List" but you'd have to use ToExpression
. So I think mx might be better
SetDirectory[NotebookDirectory[]];
lst = {{{1, 2}, {4, 5}}, {5}, {1, 2, 3, 4}};
Export["foo.txt", lst, "List"];
lst0 = ToExpression[Import["foo.txt", "List"]];
lst === lst0
(* True *)