# -*- coding: utf-8 -*-
#python 27
#xiaodeng
#使用urllib2实现图片文件下载
#来源:my2010Sam



import urllib2
import os
print os.getcwd()#python所在工作目录
response=urllib2.Request('http://picm.photophoto.cn/015/037/003/0370030333.jpg')
rs=urllib2.urlopen(response)
print rs

f=open('test.jpg','wb')#以二进制写模式打开,rb+:以二进制读写模式打开 
f.write(rs.read())
f.close()

 

相关文章:

  • 2022-12-23
  • 2021-07-26
  • 2022-02-03
  • 2022-01-06
  • 2022-12-23
  • 2022-12-23
  • 2022-01-26
猜你喜欢
  • 2021-05-22
  • 2022-01-11
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2021-09-05
相关资源
相似解决方案