使用urllib.request库从互联网上下载图片
# coding=utf-8
import urllib.request as request
url = 'http://localhost:8080/NoteWebService/logo.png'
with request.urlopen(url) as response:
data = response.read()
f_name = 'download.png'
with open(f_name, 'wb') as f:
f.write(data)
print('下载文件成功')