This recent artificial intelligence comparison fire, looked at a bit of Python code, recently look at the Python code, a out of the hole, the question of space first not to say directly on the code bar
# coding = Utf-8import Urllib.request#import Ssl#ssl._create_default_https_context = ssl._create_unverified_ Contextresponse = Urllib.request.urlopen (' https://www.douban.com/') print (Response.read (). Decode (' Utf-8 '))
Python Python3 log_python.py
Traceback (most recent):
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/urllib/ request.py ", line 1318, in Do_open
Encode_chunked=req.has_header (' transfer-encoding '))
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/http/ client.py ", line 1239, in Request
Self._send_request (method, URL, body, headers, encode_chunked)
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/http/ client.py ", line 1285, in _send_request
Self.endheaders (body, encode_chunked=encode_chunked)
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/http/ client.py ", line 1234, in Endheaders
Self._send_output (Message_body, encode_chunked=encode_chunked)
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/http/ client.py ", line 1026, in _send_output
Self.send (msg)
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/http/ client.py ", line 964, in send
Self.connect ()
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/http/ client.py ", line 1400, in Connect
Server_hostname=server_hostname)
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/ssl.py", Line 401, in Wrap_socket
_context=self, _session=session)
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/ssl.py", Line 808, in __init__
Self.do_handshake ()
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/ssl.py", Line 1061, in Do_handshake
Self._sslobj.do_handshake ()
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/ssl.py", Line 683, in Do_handshake
Self._sslobj.do_handshake ()
Ssl. Sslerror: [ssl:certificate_verify_failed] CERTIFICATE VERIFY FAILED (_ssl.c:749)
During handling of the above exception, another exception occurred:
Traceback (most recent):
File "log_python.py", line 6, <module>
Response = Urllib.request.urlopen (' https://www.douban.com/')
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/urllib/ request.py ", line 223, in Urlopen
Return Opener.open (URL, data, timeout)
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/urllib/ request.py ", line 526, in open
Response = Self._open (req, data)
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/urllib/ request.py ", line 544, in _open
' _open ', req)
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/urllib/ request.py ", line 504, in _call_chain
result = Func (*args)
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/urllib/ request.py ", line 1361, in Https_open
Context=self._context, Check_hostname=self._check_hostname)
File "/usr/local/homebrew/cellar/python3/3.6.0/frameworks/python.framework/versions/3.6/lib/python3.6/urllib/ request.py ", line 1320, in Do_open
Raise Urlerror (ERR)
Urllib.error.URLError: <urlopen error [ssl:certificate_verify_failed] CERTIFICATE VERIFY FAILED (_ssl.c:749) >
Out a bunch of mistakes, and then found the answer in Http://stackoverflow.com/questions/27835619/ssl-certificate-verify-failed-error:
To introduce a module of SSL, then, then, there is no
Beginner Python encounters a pit