【发布时间】:2017-02-15 10:23:14
【问题描述】:
当我运行第一个函数时,它会打印正确的 URL。但是,当我运行第二部分时,它显示一个错误,指出未定义 fullurl。
谁能帮我解决这个问题?
这是我的代码:
def urlmaker(format_mtg):
fullurl = url + format_mtg.get() + "-constructed-league-" + date.get() #adds the users options to the url
print(fullurl)
return fullurl
def htmltotxt(fullurl):
print(fullurl)
response = urllib.request.urlopen(fullurl) #requests the ability to open the website, which magic.wizards.com allows
html = response.read() #reads the html data from the open website
html = str(html) #saves the data as a string
make_lists(card_name_regex, card_number_regex, card_number_list, html)
【问题讨论】:
-
请使用空格。 Python 不按字符收费。
-
另外,显示实际的完整错误和回溯。您发布的代码中没有任何内容会给出该错误。
-
您还没有展示如何调用这些函数。请也包括在内。另外,请检查您的缩进。
标签: python function python-3.x return