IPython Documentation

Table Of Contents

Previous topic

Module: nbformat.current

Next topic

Module: nbformat.sign

This Page

Note

This documentation is for a development version of IPython. There may be significant differences from the latest stable release.

Module: nbformat.reader

API for reading notebooks.

Authors:

  • Jonathan Frederic

1 Class

class IPython.nbformat.reader.NotJSONError

Bases: exceptions.ValueError

4 Functions

IPython.nbformat.reader.parse_json(s, **kwargs)

Parse a JSON string into a dict.

IPython.nbformat.reader.get_version(nb)

Get the version of a notebook.

Parameters:

nb : dict

NotebookNode or dict containing notebook data.

Returns:

Tuple containing major (int) and minor (int) version numbers

IPython.nbformat.reader.reads(s, **kwargs)

Read a notebook from a json string and return the NotebookNode object.

This function properly reads notebooks of any version. No version conversion is performed.

Parameters:

s : unicode

The raw unicode string to read the notebook from.

Returns:

nb : NotebookNode

The notebook that was read.

IPython.nbformat.reader.read(fp, **kwargs)

Read a notebook from a file and return the NotebookNode object.

This function properly reads notebooks of any version. No version conversion is performed.

Parameters:

fp : file

Any file-like object with a read method.

Returns:

nb : NotebookNode

The notebook that was read.