python 3.6 - Except statement gives syntax error -


the code same in book web scraping python according code tested on python version 3.4+. python ide using python 3.6.x, still shows syntax error.

the error is

 except(urlerror, httperror, contenttooshorterror) e: ^ syntaxerror: invalid syntax 

here's code:

    import urllib.request     urllib.error import urlerror, httperror, contenttooshorterror     def download(url):     print('downloading:', url)     try:         html = urllib.request.urlopen(url).read()         except(urlerror, httperror, contenttooshorterror) e:         print('download error:', e.reason)         html = none         return html         download('https://en.wikipedia.org/wiki/main_page') 


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -