writes expr to a file.
writes a sequence of expressions expri to a file.
creates an empty file with the specified name.
Details and Options
- 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.
- expr>>filename 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 .m 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.
- Put[…,File["file"]] is also supported.
Examplesopen all close all
Basic Examples (1)
Put the value of a into a file:
Introduced in 1988Updated in 2016