Python:Traceback nameerror

时间:2013-07-31 15:30:43

标签: python urllib httplib

Traceback <most recent call last>:
  File "wexec.py", line 37, in <module>
   urlopen = urllib.urlopen('%xs' % (hcon))
NameError: name 'hcon' is not defined

我通过在python中执行此代码来解决这个问题:

def hell():

    hcon = raw_input(Fore.RED + Style.BRIGHT + "Website: ")
    h1 = httplib.HTTPConnection('%s' % (hcon))
    urlopen = urllib.urlopen('%s' % (hcon))

hell()

如您所见,我根本没有看到任何问题。但有些事情正在给它这个错误。我该怎么办?

0 个答案:

没有答案