[IPython-dev] Removing displayed javascript

Paul Ivanov pi@berkeley....
Wed Feb 12 13:27:36 CST 2014


MinRK, on 2014-02-11 16:51,  wrote:
> clear_output() should remove any output from a cell. It doesn't allow
> selectively removing particular outputs, though.

Here's how you can remove a particular output in JavaScript

IPython.notebook.get_cells()
.filter(function (c) { return c.cell_type === 'code'; })
.map(function (c) { c.output_area.outputs
  .map(function (o) { delete o['application/javascript']; });
})

The 'application/javascript' key is what the right key is in
master, in IPython 1.x and earlier, this key was called
'javascript'

best,
-- 
                   _
                  / \
                A*   \^   -
             ,./   _.`\\ / \
            / ,--.S    \/   \
           /  `"~,_     \    \
     __o           ?
   _ \<,_         /:\
--(_)/-(_)----.../ | \
--------------.......J
Paul Ivanov
http://pirsquared.org


More information about the IPython-dev mailing list