[IPython-dev] Octave magic

Fernando Perez fperez.net@gmail....
Fri Jun 1 17:40:27 CDT 2012


On Fri, Jun 1, 2012 at 3:16 PM, Jason Grout <jason-sage@creativetrax.com> wrote:
> Can you give an example of %%file?  That sounds interesting.

%%file foo.csv
1, 2,3
4,5,6

----

in another cell:

a = np.loadtxt('foo.csv')

etc.

The idea is that it lets you edit right in the notebook arbitrary
local files, which may be tricky to do otherwise if you're logged in a
remote notebook server to which you don't have SSH access.

Not something you're likely to use to write major library code, but
very useful for small edits.

It also means that if you have an analysis notebook that needs to run
say a few shell scripts that call out third-party tools, you can
essentially 'embed' those shell scripts in the notebook itself,
helping with portability, reusability and tracking of your tools.

It's something that is *trivial* for us to add right now, and that can
come in very handy in a multitude of scenarios.

Cheers,

f


More information about the IPython-dev mailing list