码迷,mamicode.com
首页 > 其他好文 > 详细

爬虫初试

时间:2018-04-25 00:49:07      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:from   url   www   get   utf-8   odi   imp   int   %s   

# -*- coding:utf-8 -*- 
# Author:Brownyangyang
from urllib import request
def f(url):
   print(GET:%s % url)
   resp = request.urlopen(url)
   data = resp.read()
   print("%d bytes received from %s"% (len(data),url))
   f = open("url.html","wb")
   f.write(data)
   f.close()
   print(%d bytes received from %s. %(len(data),url))

f("http://www.cnblogs.com/brownyangyang/p/8926478.html")

 

爬虫初试

标签:from   url   www   get   utf-8   odi   imp   int   %s   

原文地址:https://www.cnblogs.com/brownyangyang/p/8934762.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!