Ask Your Question

Revision history [back]

To import:

  • code from other files (.py, .sage, ..) into a notebook, this can be done simply with the load command, as in load('foo.py').

  • if you want to use standard python imports: say your library is in foo.sage, then

    %%bash sage --preparse 'foo.sage' # will import sage library (sage.all_cmdline) = everything so that Sage functions can be called externally, into a new file file foo.sage.py mv foo.sage.py foo.py # let's rename it from foo import monty

To import:

  • code from other files (.py, .sage, ..) into a notebook, this can be done simply with the load command, as in load('foo.py').

  • if you want to use standard python imports: say your library is in foo.sage, then

    %%bash sage --preparse 'foo.sage' # will import sage library (sage.all_cmdline) = everything so that Sage functions can be called externally, into a new file file foo.sage.py mv foo.sage.py foo.py # let's rename it from foo import monty

To import:

  • code from other files (.py, .sage, ..) into a notebook, this can be done simply with the load command, as in load('foo.py').

  • if you want to use standard python imports: say your library is in foo.sage, then

    %%bash sage --preparse 'foo.sage' # will import sage library (sage.all_cmdline) = everything so that Sage functions can be called externally, into a new file file foo.sage.py mv foo.sage.py foo.py # let's rename it from foo import montymonty ...

To import:

  • code from other files (.py, .sage, ..) into a notebook, this can be done simply with the load command, as in load('foo.py').

  • if you want to use standard python imports: say your library is in foo.sage, then

    %%bash %%bash

    sage --preparse 'foo.sage' # will import sage library (sage.all_cmdline) = everything so that Sage functions can be called externally, into a new file file foo.sage.py foo.sage.py

    mv foo.sage.py foo.py # let's rename it it

    from foo import monty monty

    ...

To import:

  • code from other files (.py, .sage, ..) into a notebook, this can be done simply with the load command, as in load('foo.py').

  • if you want to use standard python imports: say your library is in foo.sage, then

    %%bash

    sage --preparse 'foo.sage' # will import sage library (sage.all_cmdline) = everything so that Sage functions can be called externally, into a new file file foo.sage.py

    mv foo.sage.py foo.py # let's rename it

    from foo import monty

    ...

To import:

  • code from other files (.py, .sage, ..) into a notebook, this can be done simply with the load command, as in load('foo.py').

  • if you want to use standard python imports: say your library is in foo.sage, then

%%bash -

%%bash 

sage --preparse 'foo.sage' # will import sage library (sage.all_cmdline) = everything so that Sage functions can be called externally, into a new file file foo.sage.py

foo.sage.py

mv foo.sage.py foo.py # let's rename it

it

from foo import monty

monty ...

...

To import:

  • code from other files (.py, .sage, ..) into a notebook, this can be done simply with the load command, as in load('foo.py').

  • if you want to use standard python imports: say your library is in foo.sage, then

-

%%bash 

sage --preparse 'foo.sage' # will import sage library (sage.all_cmdline) = everything so that Sage functions can be called externally, into a new file file foo.sage.py

mv foo.sage.py foo.py # let's rename it

from foo import monty

...

To import:

  • code from other files (.py, .sage, ..) into a notebook, this can be done simply with the load command, as in load('foo.py').

  • if you want to use via standard python imports: say your library is in foo.sage, then

-

%%bash 

sage --preparse 'foo.sage' # will import sage library (sage.all_cmdline) = everything so that Sage functions can be called externally, into a new file foo.sage.py

mv foo.sage.py foo.py # let's rename it

from foo import monty

...

To import:

  • code from other files (.py, .sage, ..) into a notebook, this can be done simply with the load command, as in load('foo.py').

  • via standard python imports: say your library is in foo.sage, then

-

%%bash 

sage --preparse 'foo.sage' # will import sage library (sage.all_cmdline) = everything so that Sage functions can be called externally, into a new file foo.sage.py

mv foo.sage.py foo.py # let's rename it

-

from foo import monty

...