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

Python¼¸ÖÖ²¢·¢ÊµÏÖ·½°¸µÄÐÔÄܱȽÏ

 
#!/Library/Frameworks/Python.framework/Versions/2.5/bin/python
# encoding: utf-8
import sys, time
import thread
 
SLEEP_TIME = 0.0001
 
def run_benchmark(n, m):
    # print(">> Python 2.5.1, stackless 3.1b3 here (N=%d, M=%d)!\n" % (n, m))
    locks = [thread.allocate_lock() for i in xrange(n)]
    firstP = cin = []
    cin_lock_id = 0
    for s in xrange(1, n):
        seqn = s
        cout = []
        cout_lock_id = s
        # print("*> s = %d" % (seqn, ))
        thread.start_new_thread(loop, (seqn, locks, cin, cin_lock_id, cout, cout_lock_id))
        cin = cout
        cin_lock_id = cout_lock_id
    else:
        seqn = s+1
        # print("$> s = %d" % (seqn, ))
        thread.start_new_thread(mloop, (seqn, locks, cin, cin_lock_id))
    for r in xrange(m-1, -1, -1):
        # print("+ sending Msg#  %d" % r)
        lock = locks[0]
        lock.acquire()
        firstP.append(r)
        lock.release()
        time.sleep(SLEEP_TIME)
    try:
        while True:
            time.sleep(SLEEP_TIME)
    except:
        pass
def loop(s, locks, cin, cin_lock_id, cout, cout_lock_id):
    while True:
        lock = locks[cin_lock_id]
        lock.acquire()
        if len(cin) > 0:
            r = cin.pop(0)
            lock.release()
        else:
      &n


Ïà¹ØÎĵµ£º

python time ×Ö·û´®×ªUTC

½ñÌìÓöµ½Ò»¸öÒ»¸öÎÊÌ⣬Êǽ«×Ö·û´®ÀàÐ͵Äʱ¼äת»¯ÎªUTCʱ¼ä¡£ÀýÈçtime_str = "2009/11/09 12:23:23" ת»¯ÎªUTC intÐÍ¡£
ÕÒÁËһЩ×ÊÁÏ£¬·¢ÏÖtimeÄ£¿é¾ÍÄÜÍê³ÉÕâ¸öת»»¡£
import time
time_str = "2009/11/09 12:23:23"
time_s = time.strptime(time_str,"%Y/%m/%d %H:%M:%S")
utc_f = time.mktime(time_s)
utc_i = int ......

python¼¼Êõ×ÊÁÏ

pythonÖйúÂÛ̳     http://www.okpython.com/bbs/index.php
¿ªÔ´ÉçÇø   http://sourceforge.net/
python¹ÙÍø  http://www.python.org/
pythonIDE BOAhttp://boa-constructor.sourceforge.net/
pythonIDE ´óÈ«http://www.oschina.net/project/tag/120
python×é¼þhttp://py.dw ......

Python IDE±È½ÏÓëÍÆ¼ö¡¾z¡¿

 ÎÒÏȸøÒ»¸ö³õ²½µÄ±í¸ñ°É£¬´ó¼ÒÈç¹ûÓÐʲôÒâ¼û£¬»òÓв¹³ä£¬»¶Ó­Ìá³ö¡£ÓÐЩÎÒûÓÐÓùý£¬ÏȲ»Ð´ÁË¡£
ÒÔÏÂÊÇÎÒʹÓùýµÄpython IDE:
     
³ýÁËPythonWin, VisualPythonÖ»Ö§³ÖWindows£¬ÆäËü¶¼ÖÁÉÙÖ§³ÖWin/Linux/Mac¡£
¸÷ÏÒ壺
×Ô¶¯²¹È«£º±äÁ¿/º¯ÊýÃû´òµ½Ò»°ëʱ£¬Ìáʾ¿ÉÄܵÄÍêÕûµÄ±äÁ¿/º¯ÊýÃû¡ ......

Installing Python °²×°Python


   
You are here: Home ‣ Dive Into Python 3 ‣
Difficulty level: ♦♢♢♢♢
Installing Python °²×°Python
❝ Tempora mutantur nos et mutamur in illis. (Times change, and we change with them.) ❞
— ancient Roman proverb
 
D ......

PythonÕæµÄºÃÂð?

ΪÁËgoogleµÄgoogle appengine¶øÑ§Ï°python
·¢ÏÖËûÕæµÄ²»ÈçcÓïÑÔºÃѧ£¬µ¹²»ÊÇËûÄѶ®£¬¶øÊÇÏà¹ØÎĵµÌ«ÉÙ£¬¶øÇÒ²»¹æ·¶¡£
Ò²ÐíÊÇÎÒµÄÎÊÌâ°É£¬ÎÒ»¹ÊÇϲ»¶cÓïÑÔµÄÍ·Îļþ£¬»¹ÓÐmsdnµÄÄÇÖÖ°ïÖú¡£Ò»ÑÛ¾ÍÖªµÀʹÓ÷½·¨¡£
˵cÓïÑÔÄÑѧ£¬¿ÉÄÜÊÇÒòΪûÓÐ×Ðϸ¿´ÕâÁ½¸ö¶«Î÷°É ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ