利用dir函数查询各个数据类型的方法
>>> import sys >>> dir(sys) ['__displayhook__', '__doc__', '__excepthook__', '__name__', '__stderr__', '__st din__', '__stdout__', '_current_frames', '_getframe', 'api_version', 'argv', 'bu iltin_module_names', 'byteorder', 'call_tracing', 'callstats', 'copyright', 'dis playhook', 'dllhandle', 'exc_clear', 'exc_info', 'exc_type', 'excepthook', 'exec _prefix', 'executable', 'exit', 'getcheckinterval', 'getdefaultencoding', 'getfi lesystemencoding', 'getrecursionlimit', 'getrefcount', 'getwindowsversion', 'hex version', 'maxint', 'maxunicode', 'meta_path', 'modules', 'path', 'path_hooks', 'path_importer_cache', 'platform', 'prefix', 'ps1', 'ps2', 'setcheckinterval', ' setprofile', 'setrecursionlimit', 'settrace', 'stderr', 'stdin', 'stdout', 'subv ersion', 'version', 'version_info', 'warnoptions', 'winver'] >>> sys.version '2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]' >>> sys.version_info (2, 5, 2, 'final', 0) >>> dir(list) ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__delsli ce__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__gets lice__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', ' __le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__r educe_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__ ', '__setslice__', '__str__', 'append', 'count', 'extend', 'index', 'insert', 'p op', 'remove', 'reverse', 'sort'] >>> dir(dict) ['__class__', '__cmp__', '__contains__', '__delattr__', '__delitem__', '__doc__' , '__eq__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', ' __init__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__re duce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__str__', ' clear', 'copy', 'fromkeys', 'get', 'has_key', 'items', 'iteritems', 'iterkeys', 'itervalues', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
Work for fun,Live for love!