我正在学习Python,所以我可以轻松修改files from AIMA。我知道Java和C++,但是我发现存储库上的AIMA代码太混乱了。 Python代码看起来更简单,更优雅......但是,我不知道Python。我该如何玩这个.py文件?
我想导入search.py中的函数。
我试图创建一个search2.py文件是这样的:在文件夹上
import search
class Problem2(Problem):
pass
其中search.py是找来:
~/aima/aima-python$ python search2.py
Traceback (most recent call last):
File "search2.py", line 3, in <module>
class Problem2(Problem):
NameError: name 'Problem' is not defined
这是为什么?
可能与:http://stackoverflow.com/questions/3188929/why-import-when-you-need-to-use-the-full-name –