python: dir函数
来源:互联网 发布:数据传输软件 编辑:程序博客网 时间:2024/06/13 04:46
API
dir([object])
object
参数实验代码
导入library
print '\ndir()\n', dir()import globprint '\ndir()\n', dir()print '\ndir(glob)\n', dir(glob)
dir()['__builtins__', '__doc__', '__file__', '__name__', '__package__']dir()['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__warningregistry__', 'glob']dir(glob)['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_unicode', 'fnmatch', 'glob', 'glob0', 'glob1', 'has_magic', 'iglob', 'magic_check', 'os', 're', 'sys']
自己定义的函数
print '\ndir()\n', dir()class Person(object): def __dir__(self): return ["name", "age", "country"]tom = Person()print '\ndir(Person)\n', dir(Person)print '\ndir(tom)\n', dir(tom)print '\ndir()\n', dir()
dir()['__builtins__', '__doc__', '__file__', '__name__', '__package__']dir(Person)['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']dir(tom)['age', 'country', 'name']dir()['Person', '__builtins__', '__doc__', '__file__', '__name__', '__package__', 'tom']
阅读全文
0 0
- python dir函数
- python dir()函数作用
- python函数 - dir()
- 4.5 Python dir()函数
- python-dir()函数
- python dir()函数
- Python的dir函数
- Python 内置函数 dir()
- python: dir函数
- Python的dir()函数
- python内建函数 dir()
- python dir()内建函数
- Python函数---dir(),help(),type()
- Python标准库:内置函数dir([object])
- Python基础学习篇—dir()函数
- 用好Python帮助函数help(),dir(),type()
- python dir()
- python dir()
- No suitable driver found for jdbc:mysql://localhost/mysql
- poj1651矩阵连乘问题
- 欢迎使用CSDN-markdown编辑器
- mysql压缩版安装
- 学习博客
- python: dir函数
- java多线程--AtomicReference
- Export a buffer as a DMABUF file descriptor
- 滑动显示的窗口以及悬浮窗实现
- [转载]爱油科技基于SpringCloud的微服务实践
- Android-使用Android Studio实现第三方QQ登录
- Permutations II:有重复元素的排列
- js正则表达式基本语法(精粹)
- Swift