我有一个 python 程序,我正在尝试导入其他 python 类,我得到一个 NameError:
Traceback (most recent call last):
File "run.py", line 3, in <module>
f = wow('fgd')
NameError: name 'wow' is not defined
这是在名为的文件中new.py
:
class wow(object):
def __init__(self, start):
self.start = start
def go(self):
print "test test test"
f = raw_input("> ")
if f == "test":
print "!!"
return c.vov()
else:
print "nope"
return f.go()
class joj(object):
def __init__(self, start):
self.start = start
def vov(self):
print " !!!!! "
这是在文件中run.py
:
from new import *
f = wow('fgd')
c = joj('fds')
f.go()
我究竟做错了什么?