- import urllib.request
- url = 'http://www.whatismyip.com.tw'
- # proxy_support = urllib.request.[proxyhandler]({'http':'119.6.144.73:81'})
- proxy_support = urllib.request.ProxyHandler({'http':'119.6.144.73:81'})
- #opener = urllib.request.build_opener([proxy_srpport])
- opener = urllib.request.build_opener(proxy_support)
- urllib.request.install_opener(opener)
- # response = urllib.[requerst].urlopen(url)
- response = urllib.request.urlopen(url)
- html = response.read().decode('utf-8')
- print(html)
复制代码
注释里带[]是你出现拼写错误的地方。建议使用pycharm等IDE不要用Python shell,拼写错误都不会检测