Wolfram Language & System 10.3 (2015)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)


writes expr to a file.

writes a sequence of expressions to a file.

creates an empty file with the specified name.


  • Put starts writing output at the beginning of the file. It deletes whatever was previously in the file.
  • Put inserts a newline (line feed) at the end of its output.
  • is equivalent to expr>>"filename". The double quotes can be omitted if the file name is of the form specified in "Operator Input Forms".
  • It is conventional to use names that end with for files containing Wolfram Language input.
  • Put works with cloud and local objects.
  • Put by default writes expressions in InputForm.
  • Put[OutputForm[expr],"filename"] generates OutputForm.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Save a computed value in a temporary file:

Click for copyable input

Set the current directory to one for temporary files:

Click for copyable input

Put the value of into a file:

Click for copyable input

The file now contains the value:

Reset the directory:

Click for copyable input
Introduced in 1988
| Updated in 2014