Python内置函数dir详解
1.命令介绍
最近学习并使用了一个python的内置函数dir,首先help一下:
>>>help(dir) Helponbuilt-infunctiondirinmodule__builtin__:
dir() dir([object])->listofstrings
Returnanalphabetizedlistofnamescomprising(someof)theattributes ofthegivenobject,andofattributesreachablefromit:
Noargument: thenamesinthecurrentscope. Moduleobject: themoduleattributes. Typeorclassobject: itsattributes,andrecursivelytheattributesof itsbases. Otherwise: itsattributes,itsclass'sattributes,andrecursivelythe attributesofitsclass'sbaseclasses.