[IPython-User] add new metadata in the current notebook
epi
massimodisasha@gmail....
Fri Feb 22 20:03:45 CST 2013
Hi All,
i was looking for a way to add new "hidden metadata" such as "author" , "date", "description" .. others in the "current notebook" (e.g. during a notebook session)
i was thinking something like :
def addNbTag(key, val):
# add the new tag in the current notebook
# and save it
# nbdir = check the notebook.dir
# nbname = check the current notebook name
# nb = nbdir/nbname
# nb[u'metadata'][u'key'] = 'val'
# save the notebook embedding the new metadata
addNbTag(u''author',u'epi')
in order to be able to do in python :
from IPython.nbformat import current
f = open('file.ipynb','r')
s = f.read()
nb = current.reads(s, u'json')
nb[u'metadata'][u'author']
Have you any suggestion ?
Thanks,
MAssimo.
More information about the IPython-User
mailing list