0
嘿,夥計們,所以我嘗試了Python和我有下面的代碼返回我urllib.error.URLERROR:Python的網址有問題
import sys
import urllib.request
urlToRead = "http://www.google.ca"
crawledWebLinks = {}
while urlToRead !='':
try:
urlToRead = input("Please enter the next URL to crawl")
if urlToRead == "":
break
shortName = input("Please enter a short name for that Url "+ urlToRead)
webFile = urllib.request.urlopen(urlToRead).read()
crawledWebLinks[shortName] = webFile
except:
print("Unexpected Error", sys.exc_info()[0])
stopOrProceed = input("Hmm...stop or proceed? Enter 1 to stop and enter anything else to continue.")
if stopOrProceed == 1:
print ("Okey-Dokey\n")
break
else:
continue
print(crawledWebLinks.keys())