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