import
urllib.request
url
=
"http://www.oschina.net/"
data
=
urllib.request.urlopen(url).read()
print
(data)
'''
Created
on 2013-1-27
@author:
isaced
'''
import
urllib.request
url
=
"http://www.oschina.net/"
headers
=
(
'User-Agent'
,
'Mozilla/5.0
(Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'
)
opener
=
urllib.request.build_opener()
opener.addheaders
=
[headers]
data
=
opener.
open
(url).read()
print
(data)