Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My problem is quite simple yet I do not seem to figure out the solution to it. I am simply trying to export a list in Mathematica, actually a list of lists of lists etc, something like {{...,{...}},{...}}, but the Head is a list. I want to export this as raw Mathematica symbols so that I can access it later.

Lets take a simple list, say

list = {1,a,Pi};

I am trying:


and also


but getting the following error:

Export::infer: Cannot infer format of file listname. >>

This works for other formats such as CSV or TXT.

share|improve this question
Have you seen DumpSave[]? – Dr. belisarius Mar 11 '14 at 11:12
@belisarius was not aware of DumpSave[] and Save[] which seem to work for my purpose. Still don't understand why Export[] does not work but thanks for the tip! – someuser_ Mar 11 '14 at 11:30
@Öskå saving as "Text" does not work well in my case because I am actually trying to save lists with many different levels. It would be ideal to just save in Mathematica format. – someuser_ Mar 11 '14 at 11:36
"data" is an element not a format. The error is because you havent specified a format and none can be inferred from the file name – george2079 Mar 11 '14 at 12:22
@george2079 Thanks for clearing that but could you be more explicit? How could I save my list without converting it to another data format? I guess the command would be Export["Listname.(some extension)", list, "Data"] – someuser_ Mar 11 '14 at 12:32

Two options for exporting arbitrary Mathematica expressions are to use Put or to Export to WDX format.

list = {1, a, π};

Put[list, "test.anything"];    

(* {1, a, π} *)

Export["test.wdx", list];   

(* {1, a, π} *)
share|improve this answer
I've seen people suggest exporting using Compress as well - I don't have the experience to say if this is worth mentioning or not – Daniel Mar 11 '14 at 15:26
Thanks!! It also works with Save["test",list] and Get["test"] – someuser_ Mar 13 '14 at 16:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.