Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Python Ï̳߳صÄʵÏÖ

import urllib2
import time
import socket
from datetime import datetime
from thread_pool import *

def main():
url_list = {"sina":"http://www.sina.com.cn",
"sohu":"http://www.sohu.com",
"yahoo":"http://www.yahoo.com",
"xiaonei":"http://www.xiaonei.com",
"qihoo":"http://www.qihoo.com",
"laohan":"http://www.laohan.org",
"eyou":"http://www.eyou.com",
"chinaren":"http://www.chinaren.com",
"douban":"http://www.douban.com",
"163":"http://www.163.com",
"daqi":"http://www.daqi.com",
"qq":"http://www.qq.com",
"baidu_1":"http://www.baidu.com/s?wd=asdfasdf",
"baidu_2":"http://www.baidu.com/s?wd=dddddddf",
"google_1":"http://www.baidu.com/s?wd=sadfas",
"google_2":"http://www.baidu.com/s?wd=sadflasd",
"hainei":"http://www.hainei.com",
"microsoft":"http://www.microsoft.com",
"wlzuojia":"http://www.wlzuojia.com"}

#ʹÓÃÏ̳߳Ø
socket.setdefaulttimeout(10)
print 'start testing'
wm = WorkerManager(50)
for url_name in url_list.keys():
wm.add_job(do_get_con, url_name, url_list[url_name])
wm.wait_for_complete()
print 'end testing'

def do_get_con(url_name,url_link):
try:
fd = urllib2.urlopen(url_link)
data = fd.read()
f_hand = open("/tmp/ttt/%s" % url_name,"w")
f_hand.write(data)
f_hand.close()
except Exception,e:
pass

if __name__ == "__main__":
main()
thread_poolµÄ´úÂ루·ÇÔ­´´£¬×ª×Ô£ºhttp://blog.daviesliu.net/2006/10/09/234822/£©
import Queue, threading, sys
from threading import Thread
import time
import urllib

# working thread
class Worker(Thread):
worker_count = 0
timeout = 1
def __init__( self, workQueue, resultQueue, **kwds):
Thread._


Ïà¹ØÎĵµ£º

python»æÖÆÂÝÐýÏß

#coding=utf-8
from math import sqrt,cos,sin
import Image, ImageDraw
class SpireShape(object):
    def __init__(self, draw):
        self.draw = draw
        self.line_width = 1
     & ......

·¢²¼pythonÓ¦ÓóÌÐò

¡¾windows+python3.1.2¡¿
·¢²¼pythonÓ¦ÓóÌÐòÊǸöºÜÂé·³µÄÊ£¬ÒòΪ<1>ÎÞ·¨±àÒëÔ­Éúcode<2>ÿ¸ö°æ±¾µÄ×Ö½ÚÂ벻ͬ<3>Èç¹ûÖ±½ÓÉÏÔ´Âë»áËðº¦×Ô¼ºµÄÀûÒæ——µÈµÈ
·½·¨1——ÊÖ¶¯´ò°ü
Ôõô´ò°üÄØ£¿Ò»¸öpythonÎļþ¼ÐÒª¶þÊ®¶àMB°¡£¡
yes£¡ÎÒÃǾÍÒªÇåÀíÎÞÓõĶ«Î÷£¡
ÏÈдһ¸öwin.pyÎļþ£º ......

python pop3 ÊÕÓʼþ

def retrive_emails(pop3_server, user_name, passwd, server_port):
    #POP3
    pop_client = poplib.POP3(pop3_server, port=server_port)
    pop_client.user(user_name)
    pop_client.pass_(passwd)
   
    ......

Python¸ÅÊö

    Python ÊÇÃâ·ÑµÄ½âÊÍÐÔÓïÑÔ£¬¾ßÓÐÃæÏò¶ÔÏóµÄÌØÐÔ¡£¿ÉÒÔÔËÐÐÔÚ¶àÖÖ²Ù×÷ϵͳ֮ÉÏ£¬Python¾ßÓÐÇåÎúµÄ½á¹¹£¬¼ò½àµÄÓï·¨ÒÔ¼°Ç¿´óµÄ¹¦ÄÜ¡£Python¿ÉÒÔÍê³É´ÓÎı¾´¦Àíµ½ÍøÂçͨÐŵȸ÷ÖÖ¹¤×÷£¬python×ÔÉíÒѾ­ÌṩÁË´óÁ¿µÄÄ£¿éÀ´ÊµÏÖ¸÷ÖÖ¹¦ÄÜ£¬³ý´ËÒÔÍ⻹¿ÉÒÔʹÓÃC/C++À´À©Õ¹Python£¬ÉõÖÁ»¹¿ÉÒÔ½«PythonǶÈëµ½ÆäËûÓ ......

python²éÕÒÖÐÎÄ×Ö·û

#filename Seek.py
import unicodedata
import sys
import os
class Seek():
    """
    ¹¦ÄÜ:²éÕÒÖÐÎÄ,²¢Ìæ»»³ÉÖ¸¶¨×Ö·û»ò×Ö·û´®
    ʹÓ÷½·¨:python½Å±¾Ó÷¨
    ²ÎÊý˵Ã÷:
        -d& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ