Wolfram Language & System 10.0 (2014)|Legacy Documentation

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


reads in a file, evaluating each expression in it and returning the last one.

reads from a stream, evaluating each expression in it and returning the last one.

Details and OptionsDetails and Options

  • If name is the name of a Wolfram Language context, ending with a context mark character, then Get will process this name to find the file to read.
  • If name is the name of a file, any extension must be included explicitly.
  • Get can read files of Wolfram Language definitions written by DumpSave.
  • Get can read notebook files, returning the Wolfram Language expressions they represent.
  • is equivalent to <<name. The double quotes can be omitted if the name is of the form specified in "Operator Input Forms".
  • If a file with name file.mx is found to be a directory, Get will look for a file with a name like file.mx/$SystemID/file.mx.
  • If the file found by <<name is a directory, the Wolfram Language will try to load the file in that directory.
  • Get by default successively searches for files in the directories specified by the elements of $Path.
  • Get[name,Path->{"dir1","dir2",}] successively searches for files in each of the .
  • Syntax errors in Wolfram Language input files are reported in the standard form: . Get continues attempting to read a file even after a syntax error has been detected. However, if an error is detected, $Context and $ContextPath are reset to the values they had when Get was called.
  • Get[CloudObject[]] can be used to get files from the cloud.
  • Get[Databin[]] gets the contents of a databin in the Wolfram Data Drop.
  • During the execution of Get, the global variables $Input and $InputFileName are set to the file name and the full path of the file being read, respectively.
  • Get["file","key"] reads a file that has been encoded using Encode["source","file","key"].
  • With the Method option, the stream is opened using the given input stream method. This overrides the default way that Get resolves file names.

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Load a package:

Click for copyable input

This has set up definitions for several symbols in the context:

Click for copyable input

Get Wolfram Language input from a file:

Click for copyable input

The input is evaluated:

Click for copyable input
Introduced in 1988
| Updated in 2014