[問題] variable的定義
小弟想問個很基本的問題
當執行這段code的時候(找網頁連結的)
def get_next_target(page):
start_link = page.find('<a href=')
start_quote = page.find('"', start_link)
end_quote = page.find('"', start_quote + 1)
url = page[start_quote + 1:end_quote]
return url, end_quote
get_next_target('The site is called Google <a href= "www.google.com">')
print url
為什麼系統會說 name 'url' is not defined
謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.212.193.217
→
12/28 15:49, , 1F
12/28 15:49, 1F
→
12/28 15:58, , 2F
12/28 15:58, 2F
→
12/28 16:35, , 3F
12/28 16:35, 3F