dir 函数是干什么用的?
dir
Python中,dir 函数是用来返回一个参数的属性和方法列表,而当不带参数是,则是返回当前范围内的变量和方法等。例如:
In [1]: dir() Out[1]: ['In', 'Out', '_', ... In [2]: dir(int) Out[2]: ['__abs__', '__add__', '__and__', ...