[IPython-User] Novice notebook questions

Fernando Perez fperez.net@gmail....
Tue Feb 28 01:51:48 CST 2012


On Mon, Feb 27, 2012 at 10:07 PM, Mike Witt <msg2mw@gmail.com> wrote:
> Two beginner questions on the IPython notebook:
>
> (1) I seem to be able to select text in the notebook and paste it
>     somewhere else (into an xterm for example). But I can't figure
>     out how to select text somewhere outside the notebook and paste
>     it into a notebook cell. This is on Linux. I would normally just
>     select the text and paste it with the middle mouse button.

The middle-button paste event isn't correctly handled by codemirror,
so you must use the actual clipboard (Ctrl-C/Ctrl-V) instead, and not
the X11 selection.

> (2) I see how to load preexisting python code into a cell, via
>     "%loadpy" but I can't figure out any way to load, say, a bunch
>     of html and latex from an existing file (other than to surround it
>     with """ and pretend it's python """).  Is there any other way to
>     do this?

You can import a python file with cell markers, so if you have a bunch
of  such code that you'd like to load into files, you can mark up a
.py script manually and then import it:

http://ipython.org/ipython-doc/dev/interactive/htmlnotebook.html#the-notebook-format

That may be easier and quicker than manually copy/pasting a bunch of
cells one at a time.

Cheers,

f


More information about the IPython-User mailing list