Python¶àÏß³Ì ¼òÃ÷Àý×Ó
×ÛÊö
¶àÏß³ÌÊdzÌÐòÉè¼ÆÖеÄÒ»¸öÖØÒª·½Ã棬ÓÈÆäÊÇÔÚ·þÎñÆ÷Deamon³ÌÐò·½Ãæ¡£ÎÞÂÛºÎÖÖϵͳ£¬Ï̵߳÷¶ÈµÄ¿ªÏú¶¼±È´«Í³µÄ½ø³ÌÒª¿ìµÃ¶à¡£
Python¿ÉÒÔ·½±ãµØÖ§³Ö¶àÏ̡߳£¿ÉÒÔ¿ìËÙ´´½¨Ï̡߳¢»¥³âËø¡¢ÐźÅÁ¿µÈµÈÔªËØ£¬Ö§³ÖÏ̶߳Áдͬ²½»¥³â¡£ÃÀÖв»×ãµÄÊÇ£¬PythonµÄÔËÐÐÔÚPython
ÐéÄâ»úÉÏ£¬´´½¨µÄ¶àÏ߳̿ÉÄÜÊÇÐéÄâµÄỊ̈߳¬ÐèÒªÓÉPythonÐéÄâ»úÀ´ÂÖѯµ÷¶È£¬Õâ´ó´ó½µµÍÁËPython¶àÏ̵߳ĿÉÓÃÐÔ¡£Ï£Íû¸ß°æ±¾µÄPython¿ÉÒÔ
½â¾öÕâ¸öÎÊÌ⣬·¢»Ó¶àCPUµÄ×î´óЧÂÊ¡£
ÍøÉÏÓÐЩÅóÓÑ˵Ҫ»ñµÃÕæÕý¶àCPUµÄºÃ´¦£¬ÓÐÁ½ÖÖ·½·¨£º
1.¿ÉÒÔ´´½¨¶à¸ö½ø³Ì¶ø²»ÊÇỊ̈߳¬½ø³ÌÊýºÍcpuÒ»Ñù¶à¡£
2.ʹÓÃJython »ò IronPython£¬¿ÉÒԵõ½ÕæÕýµÄ¶àÏ̡߳£
Ïл°ÉÙ˵£¬ÏÂÃæ¿´¿´PythonÈçºÎ½¨Á¢Ïß³Ì
PythonÏ̴߳´½¨
ʹÓÃthreadingÄ£¿éµÄ ThreadÀà
Àà½Ó¿ÚÈçÏÂ
class
Thread( group=None, target=None, name=None, args=(), kwargs={})
ÐèÒª¹Ø×¢µÄ²ÎÊýÊÇtargetºÍargs. target ÊÇÐèÒª×ÓÏß³ÌÔËÐеÄÄ¿±êº¯Êý£¬argsÊǺ¯ÊýµÄ²ÎÊý£¬ÒÔtupleµÄÐÎʽ´«µÝ¡£
ÒÔÏ´úÂë´´½¨Ò»¸öÖ¸Ïòº¯Êýworker µÄ×ÓÏß³Ì
def worker(a_tid,a_account):
...
th = threading.Thread(target=worker,args=(i,acc) ) ;
Æô¶¯Õâ¸öÏß³Ì
th.start()
µÈ´ýÏ̷߳µ»Ø
threading.Thread.join(th)
»òÕßth.join()
Èç¹ûÄã¿ÉÒÔ¶ÔÒª´¦ÀíµÄÊý¾Ý½øÐкܺõĻ®·Ö£¬¶øÇÒÏß³ÌÖ®¼äÎÞÐëͨÐÅ£¬ÄÇôÄã¿ÉÒÔʹÓ㺴´½¨=¡·ÔËÐÐ=¡·»ØÊյķ½Ê½±àдÄãµÄ¶àÏ̳߳ÌÐò¡£µ«ÊÇÈç¹ûÏß³ÌÖ®¼äÐèÒª·ÃÎʹ²Í¬µÄ¶ÔÏó£¬ÔòÐèÒªÒýÈ뻥³âËø»òÕßÐźÅÁ¿¶Ô×ÊÔ´½øÐл¥³â·ÃÎÊ¡£
ÏÂÃæ½²½²ÈçºÎ´´½¨»¥³âËø
´´½¨Ëø
g_mutex = threading.Lock()
....
ʹÓÃËø
for
... :
#Ëø¶¨£¬´ÓÏÂÒ»¾ä´úÂëµ½ÊÍ·ÅÇ°»¥³â·ÃÎÊ
g_mutex.acquire()
a_account.deposite(1)
#ÊÍ·Å
g_mutex.release()
×îºó£¬Ä£ÄâÒ»¸ö¹«
Ïà¹ØÎĵµ£º
½ñÌìͻȻÓÐÒ»¸öÏë·¨£¬¾ÍÊÇÏë×Ô¼ºÐ´Ò»¸ö·Òë½Å±¾¡£¿ÉϧGoogleÌṩµÄAPIÊǹ©ÍøÂçÓ¦Óõġ£¸ÕºÃÔÚ¡¶dive into python¡·ÀïÃæÕâ±¾ÊéÀïÃæ¿´µ½ÈçºÎ´ÓHTMLÎĵµÖÐÌáÈ¡³öÀ´×Ô¼ºÏëÒªµÄÄÚÈÝ£¬ÄÇÕâÑùµÄ»°£¬¿É²»¿ÉÒÔÄ£Äâä¯ÀÀÆ÷À´·¢ËÍÏë·ÒëµÄ¾ä×Ó£¬È»ºóÔÙ½ÓÊÕ·µ»Ø½á¹ûºóµÄHTMLÔ´Â룬×îºó´ÓÖÐÌáÈ¡³ö·ÒëµÄ½á¹ûÄØ£¿¡¡¡¡ÆäʵÊÇÐеģ¬ÒòΪÀûÓ ......
python ÖÐminidom½âÎöxml
2009Äê06ÔÂ26ÈÕ ÐÇÆÚÎå 08:40
ÏÂÃæÖ»ÁгöһЩ³£Óõķ½·¨ÊôÐÔ£¬Èç¹ûÒª²é¿´¸ü¶àµÄ·½·¨£¬ ¿ÉÒÔÈ¥¿´ÎļþminidomÈçºÎʵÏֵġ£
»ñµÃDocument¶ÔÏó
·¨Ò»£º
import xml.dom.minidom as m_dom
doc1 = m_dom.getDOMImplementation().createDocument(None, "root1", None)
doc1.documentElement.toxml(e ......
1¡¢ÏÂÔØoracleÈí¼þ
http://www.oracle.com/technology/software/tech/oci/instantclient/index.html
oracle-instantclient-basic-10.2.0.4-1.i386.rpm
oracle-instantclient-sqlplus-10.2.0.4-1.i386.rpm
oracle-instantclient-devel-10.2.0.4-1.i386.rpm
2¡¢°²×°rpm°ü
rpm -ivh oracle-instantclient-basic-10.2.0.4 ......
1. Python ´®¿ÚÉ豸ӦÓÃ
¼òÊö
1.1. Ïß³ÌÂÖÑ°
·ç³¾ÎÞÏÞ <tianyu263@163.com>
-- ·ÖÏí
¾ÍÊÇ´ò¿ª´®¿Úºó£¬Æô¶¯Ò»¸öÏß³ÌÀ´¼àÌý´®¿ÚÊý¾ÝµÄ½øÈ룬ÓÐÊý¾Ýʱ£¬¾Í×öÊý¾ÝµÄ´¦Àí£¨Ò²¿ÉÒÔ·¢ËÍÒ»¸öʼþ£¬²¢Ð¯´ø½ÓÊÕµ½µÄÊý¾Ý£©¡£
Toggle line numbers
1
2 #coding=gb18030
3
4 i ......
Ethereal ×Ô´øÐí¶àÐÒéµÄ decoder,¼òµ¥,Ò×ÓÃ,»ùÓÚwinpcapµÄÒ»¸ö¿ªÔ´µÄÈí¼þ.µ«ÊÇËüµÄ¼Ü¹¹²¢²»Áé»î,ÈçºÎÄãÒª¼ÓÈëÒ»¸ö×Ô¼º¶¨ÒåµÄµÄ½âÂëÆ÷,µÃÈ¥ÐÞ¸Ä EtherealµÄ´úÂë,ÔÙÖØбàÒë,ºÜ·³Ëö.¶ÔÓÚÒ»°ãµÄÃ÷ÎÄ ÐÒé,ûÓÐʲôÎÊÌâ,µ«ÊǶÔÓÚ¼ÓÃÜÐÒé,±ÈÈçÍøÂçÓÎÏ·,¿Í»§¶Ë³ÌÐòÒ»°ã»áÔÚ¸ÕÁ¬½ÓÉϵÄʱºò,·¢ËÍÒ»¸öËæ»úÃÜÔ¿,¶øºóµÄ±¨ÎĶ¼»áÓÃÕ⸠......