Why does Export["str", str, "Table"] not evaluate to an error, where str is any expression?

  • $\begingroup$ What happens if you evaluate Import[ "str", "Table"] immediately after? $\endgroup$ – Jason B. Feb 22 '19 at 19:26
  • $\begingroup$ @Jason B {{"str"}} which, to me, is equally weird; $\endgroup$ – yosimitsu kodanuri Feb 22 '19 at 19:36
  • 2
    $\begingroup$ This seems like expected behavior. The doc page says "The Wolfram Language automatically transforms arbitrary expressions to a list of lists when exporting to the "Table" format." - if you need to restrict this to only tabular data you could write a small wrapper function that checks that the input is the right form and then calls Export $\endgroup$ – Jason B. Feb 22 '19 at 19:40
  • 4
    $\begingroup$ "str" is a perfectly good path relative to the current directory. $\endgroup$ – John Doty Feb 22 '19 at 20:04
  • 1
    $\begingroup$ Export["str", ... , "Table"] exports to the file "str" (without file extension) in Directory[]. So the full file path is FileNameJoin[{Directory[], "str"}]. Notice also that a single symbol in the second argument will converted to a string and then written to file. Run Import["str", "Text"] in order to see the verbatim file content. Hence, it is Import that converts to a table, not export. $\endgroup$ – Henrik Schumacher Feb 22 '19 at 20:16

Browse other questions tagged or ask your own question.