bundles / IPython 9.5.0 / IPython / core / magics / code / CodeMagics / load
function
IPython.core.magics.code:CodeMagics.load
Signature
def load ( self , arg_s ) Summary
Load code into the current frontend.
Extended Summary
Usage:\
%load [options] source
where source can be a filename, URL, input history range, macro, or element in the user namespace
If no arguments are given, loads the history of this session up to this point.
Options:
-r <lines>: Specify lines or ranges of lines to load from the source. Ranges could be specified as x-y (x..y) or in python-style x:y (x..(y-1)). Both limits x and y can be left blank (meaning the beginning and end of the file, respectively).
-s <symbols>: Specify function or classes to load from python source.
-yDon't ask confirmation for loading source above 200 000 characters.
-nInclude the user's namespace when searching for source code.
This magic command can either take a local filename, a URL, an history range (see %history) or a macro as argument, it will prompt for confirmation before loading source with more than 200 000 characters, unless -y flag is passed or if the frontend does not support raw_input
%load %load myscript.py %load 7-27 %load myMacro %load http://www.example.com/myscript.py %load -r 5-10 myscript.py %load -r 10-20,30,40: foo.py %load -s MyClass,wonder_function myscript.py %load -n MyClass %load -n my_module.wonder_function
Aliases
-
IPython.core.magics.CodeMagics.load