在IPython

时间:2017-11-08 06:46:00

标签: python django

我正在学习Django的CBV,并打算为ListView的所有方法做一个注释。 我在IPython工作。

In [31]: dir(ListView)
Out[31]:
[...
'as_view',
 'content_type',
 'context_object_name',
 'dispatch',
 'get',
 ...
 ]

我打算将它复制到我的笔记本中以供进一步参考,而可读格式占用太多空间。 作为解决方案,我将其粘贴到标准的python控制台以获得紧凑的输出:

[...,'as_view', 'content_type', 'context_object_name', 'dispatch', 'get'....]

在IPython控制台中编写一个函数来获取这样的输出是不可能的。

如何在IPython控制台中实现它?

1 个答案:

答案 0 :(得分:0)

如果您使用的是Python 2,请执行print(dir(ListView))print dir(ListView)

相关问题