我有一堆类类型(派生自type
)。当我把它们打印出来的时候,我会得到这样的东西:
...
<class 'Default.new_templates.NewSnippetCommand'>
<class 'Default.new_templates.NewSyntaxCommand'>
<class 'Default.pane.ClosePaneCommand'>
<class 'Default.pane.FocusNeighboringGroup'>
<class 'Default.pane.MoveToNeighboringGroup'>
<class 'Default.pane.NewPaneCommand'>
<class 'Default.pane.SetMaxColumns'>
...
我想打印:
...
NewSnippetCommand
NewSyntaxCommand
ClosePaneCommand
FocusNeighboringGroup
MoveToNeighboringGroup
NewPaneCommand
SetMaxColumns
...
我怎样才能到达类名部分而忽略模块部分呢?你知道吗
您可以使用^{} attribute :
类的名称是
__name__
属性:相关问题 更多 >
编程相关推荐