|
|
发表于 2017-11-18 12:25:26
|
显示全部楼层
值是 False 啊,说明 dir(scipy) 里没有 'misc' 啊。
具体您“用print函数输出dir(scipy)的每一项”的代码是怎么样的?
我用:
- for item in dir(scipy):
- print(item)
复制代码
并没有看到 'misc' 。
https://docs.python.org/3.6/library/functions.html#dir
dir([object])
Without arguments, return the list of names in the current local scope. With an argument, attempt to return a list of valid attributes for that object.
If the object has a method named __dir__(), this method will be called and must return the list of attributes. This allows objects that implement a custom __getattr__() or __getattribute__() function to customize the way dir() reports their attributes.
If the object does not provide __dir__(), the function tries its best to gather information from the object’s __dict__ attribute, if defined, and from its type object. The resulting list is not necessarily complete, and may be inaccurate when the object has a custom __getattr__().
The default dir() mechanism behaves differently with different types of objects, as it attempts to produce the most relevant, rather than complete, information:
If the object is a module object, the list contains the names of the module’s attributes.
If the object is a type or class object, the list contains the names of its attributes, and recursively of the attributes of its bases.
Otherwise, the list contains the object’s attributes’ names, the names of its class’s attributes, and recursively of the attributes of its class’s base classes.
|
|