0. 查看模块的包含方法
1. 内置dir函数可以查看模块的所有方法,其中包括以__开头和结尾的内置方法
举例:
import tables
使用tables.openFile(......)
报错:AttributeError: 'module' object has no attribute 'openFile'
解决办法:
dir(tables)
列出其所有方法,发现有open_file()这个方法。替换之后,tables.open_file(......),正确运行!
0. 查看模块的包含方法
1. 内置dir函数可以查看模块的所有方法,其中包括以__开头和结尾的内置方法
举例:
import tables
使用tables.openFile(......)
报错:AttributeError: 'module' object has no attribute 'openFile'
解决办法:
dir(tables)
列出其所有方法,发现有open_file()这个方法。替换之后,tables.open_file(......),正确运行!