list of methods for python shell?

后端 未结 9 1369
鱼传尺愫
鱼传尺愫 2021-02-13 21:27

You\'d have already found out by my usage of terminology that I\'m a python n00b.

straight forward question:

How can i see a list of methods for a particular obj

9条回答
  •  伪装坚强ぢ
    2021-02-13 21:46

    If you want only methods, then

    def methods(obj):
        return [attr for attr in dir(obj) if callable(getattr(obj, attr))]
    

    But do try out IPython, it has tab completion for object attributes, so typing obj. shows you a list of available attributes on that object.

提交回复
热议问题