Python脚本刷点击率。
2015-07-15 16:07
573 查看
新建一个文本文件,并且改名为shua.py
内容:
打开cmd,定位到shua.py这个文件目录下,并执行,该文件执行完毕后会关闭。
利用bat文件,一直循环执行这个shua.py。
新建一个文本文件,并且命名为againshua.bat。
内容:
注:asd只是一个标示,可以随便起一个名字,goto asd是跳转到标示处。
内容:
import urllib2 import timeit import thread import time i = 0 mylock = thread.allocate_lock() def test(no,r): global i url = 'http://my.csdn.net/Irvingrain' for j in range(1,r): req=urllib2.Request(url) req.add_header("User-Agent","Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)") file = urllib2.urlopen(req) print file.getcode(); mylock.acquire() i+=1 mylock.release() print i; thread.exit_thread() def fast(): thread.start_new_thread(test,(1,50)) thread.start_new_thread(test,(2,50)) fast() time.sleep(15)
打开cmd,定位到shua.py这个文件目录下,并执行,该文件执行完毕后会关闭。
利用bat文件,一直循环执行这个shua.py。
新建一个文本文件,并且命名为againshua.bat。
内容:
@echo off :asd c:/shua.py goto asd
注:asd只是一个标示,可以随便起一个名字,goto asd是跳转到标示处。
相关文章推荐
- Python动态类型的学习---引用的理解
- Python3写爬虫(四)多线程实现数据爬取
- 垃圾邮件过滤器 python简单实现
- 下载并遍历 names.txt 文件,输出长度最长的回文人名。
- install and upgrade scrapy
- Scrapy的架构介绍
- Centos6 编译安装Python
- 使用Python生成Excel格式的图片
- 让Python文件也可以当bat文件运行
- [Python]推算数独
- Python中zip()函数用法举例
- Python中map()函数浅析
- Python在CAM软件Genesis2000中的应用
- 使用Shiboken为C++和Qt库创建Python绑定
- FREEBASIC 编译可被python调用的dll函数示例
- Python 七步捉虫法