Every line of 'show image in jupyter notebook' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
21 def show_notebook(fname): 22 """display a short summary of the cells of a notebook""" 23 with io.open(fname, 'r', encoding='utf-8') as f: 24 nb = nbformat.read(f, 4) 25 html = [] 26 for cell in nb.cells: 27 html.append("<h4>{0} cell</h4>".format(cell.cell_type)) 28 if cell.cell_type == 'code': 29 html.append(highlight(cell.source, lexer, formatter)) 30 else: 31 html.append("<pre>{0}</pre>".format(cell.source)) 32 display(HTML('\n'.join(html)))
36 @contextmanager 37 def show(self, what): 38 self.begin(what) 39 yield 40 self.end()