python3.7 爬虫学习 1 获取页面

import urllib.request

response = urllib.request.urlopen("http://placekitten.com/g/200/300")

cat_jpg = response.read()

with open('cat_200_300.jpg', 'wb') as f:
    f.write(cat_jpg)

获取一张猫图片 

import urllib.request

response = urllib.request.urlopen("http://placekitten.com/g/200/300")

cat_jpg = response.read()

with open('cat_200_300.jpg', 'wb') as f:
    f.write(cat_jpg)

 

你可能感兴趣的:(python,爬虫,python获取界面)