码迷,mamicode.com
首页 > 编程语言 > 详细

Python小例子

时间:2014-11-06 17:21:46      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   ar   os   for   sp   文件   

import urllib.request as request
import urllib.parse as parse
import string
print("""
+++++++++++++++++++++++
   数据挖掘哪家强?
   北京朝阳找龙道!
+++++++++++++++++=++++
     """)
def baidu_tieba(url, begin_page, end_page):
    for i in range(begin_page, end_page + 1):
        #sName = ‘E:/Python_test/‘+str(i).zfill(5)+‘.html‘
        m = request.urlopen(url+str(i)+.html).read()
        print(源码:+str(m))
        #sName = ‘E:/Python_test/‘+str(i)+‘.html‘
        #print(‘正在下载第‘+str(i)+‘个页面, 并保存为‘+sName)
        #写进文件
        #with open(sName,‘wb‘) as file:
            #file.write(m)
        #file.close()
if __name__ == "__main__":
    url = "http://www.nipic.com/show/"
    begin_page = 10986746
    end_page = 10986748
    baidu_tieba(url, begin_page, end_page)

 

Python小例子

标签:style   blog   http   color   ar   os   for   sp   文件   

原文地址:http://www.cnblogs.com/gisblogs/p/4079126.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!