python3.7爬取百度首页

# -*- coding: utf-8 -*-
import urllib.request
import urllib

url = "http://www.baidu.com"
response = urllib.request.urlopen(url)
content = response.read().decode('utf-8')
print(content)

 

你可能感兴趣的:(python3.7爬取百度首页)