Pretty print the object and display it through a pager. %page [options] OBJECT If no object is given, use _ (last output). Options: -r: page str(object), don't pretty-print it.
(self, parameter_s='')
| 277 | |
| 278 | @line_magic |
| 279 | def page(self, parameter_s=''): |
| 280 | """Pretty print the object and display it through a pager. |
| 281 | |
| 282 | %page [options] OBJECT |
| 283 | |
| 284 | If no object is given, use _ (last output). |
| 285 | |
| 286 | Options: |
| 287 | |
| 288 | -r: page str(object), don't pretty-print it.""" |
| 289 | |
| 290 | # After a function contributed by Olivier Aubert, slightly modified. |
| 291 | |
| 292 | # Process options/args |
| 293 | opts, args = self.parse_options(parameter_s, 'r') |
| 294 | raw = 'r' in opts |
| 295 | |
| 296 | oname = args and args or '_' |
| 297 | info = self.shell._ofind(oname) |
| 298 | if info['found']: |
| 299 | txt = (raw and str or pformat)( info['obj'] ) |
| 300 | page.page(txt) |
| 301 | else: |
| 302 | print('Object `%s` not found' % oname) |
| 303 | |
| 304 | @line_magic |
| 305 | def pprint(self, parameter_s=''): |