I produce several times automatically a number of different lists of varying length and structure like:
listA = {{100, 1.7*^10, 2.08*^9}, {105, 1.91*^10, 1.02*^9}, {110,
2.5*^10, 3.08*^9}};
listB = {{126, 27.6, 3.19}, {131, 29.21, 3.2}};
listC = {3.84, 2.9, 5.90, 4.2, 1.3, 0.91, 1.19, 1.5, 2.79, 2.9};
Those I export via: Export["lists.txt", {listA, listB, listC}, "Table"]
. I know, that I can import them as a whole Import["lists.txt", "Table"]
but I would like to automatically import them list-wise similar to the following fantasy code:
list1 = Import["lists.txt", listA]
list2 = Import["lists.txt", listB]
list3 = Import["lists.txt", listC]
But this doesn't work. And since my lists have varying length, I can't use Part
after the import process, since I don't know which length the listA has in the specific case.
Is there an import procedure, which can be used? Do I have to use another export method in order to enable an easier import?
{list1, list2, list3} = Import["lists.txt", "Table"]
? $\endgroup$Part
, that is,imp=Import["lists.txt","Table"]; imp[[1]]
is just fine to get the first list. Similarly, forimp[[2]]
,imp[[3]]
. $\endgroup$