1. 爬取csdn首页所有文章
1.1 方法1
import urllib.request
import re\nurl='http://blog.csdn.net/'
#伪装浏览器
headers=('User-Agent','Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0')
opener=urllib.request.build_opener()
opener.addheaders=
1