bundles / nbformat 5.11.1 / nbformat / read
function
nbformat:read
source: /nbformat/__init__.py:140
Signature
def read(fp, as_version, capture_validation_error = None, **kwargs)Summary
Read a notebook from a file as a NotebookNode of the given version.
Extended Summary
The string can contain a notebook of any version. The notebook will be returned as_version, converting, if necessary.
Notebook format errors will be logged.
Parameters
fp: file or strA file-like object with a read method that returns unicode (use
io.open()in Python 2), or a path to a file.as_version: intThe version of the notebook format to return. The notebook will be converted, if necessary. Pass nbformat.NO_CONVERT to prevent conversion.
capture_validation_error: dict, optionalIf provided, a key of "ValidationError" with a value of the ValidationError instance will be added to the dictionary.
Returns
nb: NotebookNodeThe notebook that was read.
Aliases
nbformat.read