代码改变世界

网络爬虫基础篇

2017-04-13 18:04  hl_流星  阅读(166)  评论(0编辑  收藏  举报

在实战中学习

  实战1(爬一个网页图片):

    import urllib.request

    response =urllib.request.urlopen(http://placekitten.com/g/500/600")

    cat.img = response.read()

    with open('cat_500_600.jpg',"wb") as f:

      f.write(cat_img)

    解读: