#!/usr/bin/env python
# _*_ coding:utf-8 _*_
import datetime
import sys
import os
import urllib
import threading
import webbrowser
import time
def worker_open_blog():
print "start worker time:%s,and threading pid is %s"% (time.time(),threading.current_thread())
url="http://dbspace.blog.51cto.com/6873717/1882681"
w=webbrowser.open(url)
s=urllib.urlopen(url)
print s.getcode()
print "close web time:%s,and threading pid is %s"% (time.time(),threading.current_thread())
gSem=threading._Semaphore(3)
def multhread_open_http():
for i in range(60):
s1=threading.Thread(target=worker_open_blog(),args=[gSem])
s1.start()
#os.system('taskkill /F /IM 360se.exe ') ##关闭360
if __name__=="__main__":
multhread_open_http()
本文转自 DBAspace 51CTO博客,原文链接:http://blog.51cto.com/dbaspace/1882924