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小例子的更多相关文章

  1. 这42个Python小例子,太走心

    告别枯燥,60秒学会一个Python小例子.奔着此出发点,我在过去1个月,将平时经常使用的代码段换为小例子,分享出来后受到大家的喜欢. 一.基本操作 1 链式比较 i = 3print(1 <  ...

  2. python小例子(三)

    1.提高Python运行速度的方法 (1)使用生成器,节约大量内存: (2)循环代码优化,避免过多重复代码的执行: (3)核心模块使用cpython,pypy等: (4)多进程,多线程,协程: (5) ...

  3. python小例子(一)

    参考链接:https://zhuanlan.zhihu.com/p/83998758?utm_source=qq&utm_medium=social&utm_oi=7282008528 ...

  4. python小例子(二)

    1.在函数里面修改全局变量的值 2.合并两个字典.删除字典中的值 3.python2和python3 range(1000)的区别 python2返回列表,python3返回迭代器 4.什么样的语言可 ...

  5. Python小例子(判断质数)

    只能被自己或者1整除的数为质数 num = int(input('请输入一个数:')) if num > 1: # 查看因子 for i in range(2, num): if (num % ...

  6. Python小例子(求和)

    简单的数字的求和: a = input('请输入第一个数:') b = input('请输入第二个数:') sum = float(a) + float(b) print('数字{0}和数字{1}相加 ...

  7. [Spark][Hive][Python][SQL]Spark 读取Hive表的小例子

    [Spark][Hive][Python][SQL]Spark 读取Hive表的小例子$ cat customers.txt 1 Ali us 2 Bsb ca 3 Carls mx $ hive h ...

  8. [Python]Python 使用 for 循环的小例子

    [Python]Python 使用 for 循环的小例子: In [7]: for i in range(5): ...: print "xxxx" ...: print &quo ...

  9. [python]python 遍历一个list 的小例子:

    [python]python 遍历一个list 的小例子: mlist=["aaa","bbb","ccc"]for ss in enume ...

随机推荐

  1. android dialog 模拟新浪、腾讯title弹框效果

    http://blog.csdn.net/jj120522/article/details/7764183 首先我们看一下新浪微博的效果(其它就是一个dialog):                点 ...

  2. android文章学习 侧滑菜单实现

    http://blog.csdn.net/jj120522/article/details/8075249 http://blog.csdn.net/lilybaobei/article/detail ...

  3. 3Sum & 4Sum

    3 Sum Given an array S of n integers, are there elements a, b, c in Ssuch that a + b + c = 0? Find a ...

  4. 利用 ffmpeg + ImageMagick + 批处理 生成高品质gif动画

    这几天研究如何生成高品质 gif 动画,重新研究 ffmpeg, 目前有一些自动转换工具,效果不佳. Video_to_320x180.bat 把 out.avi 转换成320x180的 01.avi ...

  5. 【JAVA、C++】LeetCode 004 Median of Two Sorted Arrays

    There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two ...

  6. Java for LeetCode 058 Length of Last Word

    Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the l ...

  7. IOS多线程(NSOperation,NSOperationQueue)

    含义:NSOperation,NSOperationQueue是什么. The NSOperation class is an abstract class you use to encapsulat ...

  8. git merge和个git rebase的区别

    http://stackoverflow.com/questions/16666089/whats-the-difference-between-git-merge-and-git-rebase/16 ...

  9. July 19th, Week 30th Tuesday, 2016

    The good seaman is known in bad weather. 惊涛骇浪,方显英雄本色. You can't be afraid to fail. It's the only way ...

  10. 一、HTML和CSS基础--HTML+CSS基础课程--第4部分

    第七章 CSS的继承.层叠和特殊性 继承:CSS的某些样式是具有继承性的,那么什么是继承呢?继承是一种规则,它允许样式不仅应用于某个特定html标签元素,而且应用于其后代. 特殊性
权值的规则: 标签 ...