[IPython-dev] iPython 3.0 Creating a new notebook programatically.
Doug Blank
doug.blank at gmail.com
Sat Feb 7 07:23:02 EST 2015
On Fri, Feb 6, 2015 at 9:43 PM, John Omernik <john at omernik.com> wrote:
> Cool, that worked, thank you. Is there a place that I could have
> derived that from docs? I guess, I don't mind asking on list,
> especially if others gain benefit, but I also try to figure things out
> myself, and my research really led me nowhere. If there was a place
> that wasn't coming up in my searches that would have helped, I'd like
> to bookmark it.
>
I spend a bit of time interactively exploring what is available by just
pressing TAB. For example, if you import the library:
In[ ]: import IPython.nbformat
And then type:
In[ ]: IPython.nbformat.
... and press TAB, you'll see all of the methods available, Type a few
letters and then press TAB again and it will complete the name. Put a
question mark after the function (or press Shift+TAB in the notebook) and
you'll see a brief explanation. Two question marks on the end will show the
source code.
-Doug
>
>
>
> On Fri, Feb 6, 2015 at 8:13 PM, Doug Blank <doug.blank at gmail.com> wrote:
> > Two changes:
> >
> > 1) You should use a particular notebook format version:
> >
> > nb = IPython.nbformat.v4.new_notebook()
> >
> > 2) Worksheet has been removed; so:
> >
> > nb["cells"].append(IPython.nbformat.v4.new_code_cell("x = 1"))
> >
> > Hope that helps,
> >
> > -Doug
> >
> > On Fri, Feb 6, 2015 at 8:59 PM, John Omernik <john at omernik.com> wrote:
> >>
> >> Hey all, I have been through the API docs for iPython 3, but I can't
> >> figure out how to reproduce this in iPython 3. (It worked in iPython
> >> 2.3)
> >>
> >> http://nbviewer.ipython.org/gist/fperez/9716279
> >>
> >> In iPython 3, I get an error at
> >> nb['worksheets'].append(nbf.new_worksheet(cells=cells))
> >>
> >> I tried some different stuff win imports. I.e. instead of
> >>
> >> from IPython.nbformat import current as nbf
> >>
> >> I did from iPython.nbformat import v4 as nbf and some other stuff to
> >> get write. But that's where I am currently stuck. Any pointers would
> >> be helpful. Basically I want a code that will create a new notebook,
> >> and pre fill the few lines.
> >>
> >> Thanks!
> >>
> >> John
> >> _______________________________________________
> >> IPython-dev mailing list
> >> IPython-dev at scipy.org
> >> http://mail.scipy.org/mailman/listinfo/ipython-dev
> >
> >
> >
> > _______________________________________________
> > IPython-dev mailing list
> > IPython-dev at scipy.org
> > http://mail.scipy.org/mailman/listinfo/ipython-dev
> >
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150207/4d4dfd89/attachment.html>
More information about the IPython-dev
mailing list