亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

python實(shí)現(xiàn)保存網(wǎng)頁(yè)到本地示例

 更新時(shí)間:2014年03月16日 10:36:03   作者:  
這篇文章主要介紹了python實(shí)現(xiàn)保存網(wǎng)頁(yè)到本地示例,需要的朋友可以參考下

學(xué)習(xí)python示例:實(shí)現(xiàn)保存網(wǎng)頁(yè)到本地

復(fù)制代碼 代碼如下:

#coding=utf-8
__auther__ = 'xianbao'
import urllib
import os
def reporthook(blocks_read, block_size, total_size):
 if not blocks_read:
  print '打開(kāi)連接'
  return
 if total_size < 0:
  print "%d正在讀取(%dbytes完成)"%(blocks_read, blocks_read * block_size)
 else:
  amout_read = block_size * blocks_read
  print '%d正在讀取,%d/%d'%(blocks_read, amout_read, total_size)
 return

try:
 filename, msg = urllib.urlretrieve('http://chabaoo.cn/', reporthook=reporthook)
 print
 print '文件是:', filename
 print '頭文件是'
 print msg
 print '刪除前的文件地址:', os.path.exists(filename)

finally:
 urllib.urlcleanup()

 print '文件依然存在:', os.path.exists(filename)

相關(guān)文章

最新評(píng)論