Python read page from URL? Better documentation?
问题 I'm having quite a bit of trouble with Python's documentation. Is there anything like the Mozilla Developer Network for it? I'm doing a Python puzzle website and I need to be able to read the content of the page. I saw the following posted on a site: import urllib2 urlStr = 'http://www.python.org/' try: fileHandle = urllib2.urlopen(urlStr) str1 = fileHandle.read() fileHandle.close() print ('-'*50) print ('HTML code of URL =', urlStr) print ('-'*50) except IOError: print ('Cannot open URL %s