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

[Python module] queue

8.8. queue — A synchronized queue class¶
queue -- Ò»¸öͬ²½¶ÓÁÐÀà
The queue module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be exchanged safely between multiple threads. The Queue class in this module implements all the required locking semantics. It depends on the availability of thread support in Python; see the threading module.
queueÄ£¿é´¦Àí¶àÉú²úÕߺͶàÏû·ÑÕߵĶÓÁС£ÔÚ¶àÏ̼߳äÐÅÏ¢µÄ°²È«½»»»·Ç³£ÓÐÓá£Õâ¸ömoduleµÄQueueÀà´¦ÀíËùÐèµÄlockingÓïÒ壬ËüÒÀÀµÓÚthreadingÄ£¿é¡£
Implements three types of queue whose only difference is the order that the entries are retrieved. In a FIFO queue, the first tasks added are the first retrieved. In a LIFO queue, the most recently added entry is the first retrieved (operating like a stack). With a priority queue, the entries are kept sorted (using the heapq module) and the lowest valued entry is retrieved first.
ÈýÖÖÀàÐ͵ĶÓÁУ¬FIFO£¬LIFO£¬ÒÔ¼°ÓÅÏȶÓÁУ¨Ê¹ÓÃheapqÄ£¿é£¬ÏÈÈ¡µÃµÍÓÅÏȼ¶£©¡£
The queue module defines the following classes and exceptions:
class queue.Queue(maxsize)¶Constructor for a FIFO queue. maxsize is an integer that sets the upperbound limit on the number of items that can be placed in the queue. Insertion will block once this size has been reached, until queue items are consumed. If maxsize is less than or equal to zero, the queue size is infinite.
´´½¨FIFP¶ÓÁС£maxsiaze <= 0, ÎÞÏÞÖÆ
class queue.LifoQueue(maxsize)¶Constructor for a LIFO queue. maxsize is an integer that sets the upperbound limit on the number of items that can be placed in the queue. Insertion will block once this size has been reached, until queue items are consumed. If maxsize is less than or equal to zero, the queue size is infinite.
´´½¨LIFO¶ÓÁС£maxsiaze <= 0, ÎÞÏÞÖÆ
class queue.PriorityQueue(maxsize)¶
Constructor for a priority queue. maxsize is an integer that sets the upperbound limit on the number of items that can be place


Ïà¹ØÎĵµ£º

PYTHON½Ì³Ì [Symbian]

Ò»¡¢pythonÊÇʲô£¿
Æäʵ£¬python¾ÍÊÇÒ»Ãűà³ÌÓïÑÔ£¬¾ÍÏñjavaÒ»Ñù¡£±¾À´ÊÇÔÚµçÄÔÉϵģ¬µ«ÊÇËæ×ÅÊÖ»úµÄÁ÷ÐУ¬python±»ÒÆÖ²µ½ÁËÊÖ»úÉÏ£¬Í¬Ê±Ò²±»ÃüÃûΪpyS60¡£
¶þ¡¢pyÈí¼þµÄ¹¹Ôì
ËùÓеÄpyÈí¼þ¶¼Òª°üÀ¨ÈçÏÂÎļþ£º.app--1.65k£».rsc--337b£».aif¡£ÕâÈý¸öÎļþÔÚËùÓÐpyÈí¼þÖж¼ÊÇÏàͬµÄ£¬Î¨Ò»µÄÇø±ð¾ÍÊÇÈí¼þµÄuid²»Í¬¡£ÕâЩÎļ ......

pythonѧϰ±Ê¼Ç——pcap×¥°ü

½ñÌì¿´¿´ÈçºÎÓÃpythonʵÏÖ×¥°ü¡£
    ÒÔÇ°ÎÒÃÇÔøÓùýwinpcapʵÏÖ×¥°ü£¬Æäʵ½ñÌìÎÒÃÇ»¹ÊÇÓÃËü£¬Ö»²»¹ýÊÇËüÔÚpythonϵÄÄ£¿é£¬ÔÚÓÃ֮ǰÎÒÃDZØÐëÏÈÏÂÔØÁ½¸ö¿â£¬pcap¿âºÍdpkt¿â£¬Õâ¸ö¿ÉÒÔÔÚGoogle codeÀïºÜÈÝÒ×ÕÒµ½£¬ÐèҪעÒâµÄÊÇpcapÖ»Ö§³Öµ½python2.5 £¬ËùÒÔÎÒÃÇÒªÓÃ2.5À´±àд¡£
    °²×°ÍêÁ ......

Performance Python Vs Java


£ª javaÇ¿ÖÆʹÓÃOO½øÐÐÓ¦Óÿª·¢£¬Python¿ÉÒÔÓú¯Êýʽ±à³Ì¡£º¯ÊýʽÓÐʱÏԵ÷dz£¼òµ¥£¬´úÂëÁ¿¾Þ¼õ¡£»ØÏëÆðJava¶¯²»¶¯µÄN²ã¡¢»¹ÓÐÒ»¸ö¸ö¶ÔÏó£¬ÕæµÄÓÐÄÇÖÖÐÄÒªÂ𣿶øÇÒPython±¾ÉíÓïÑÔ·ç¸ñ¾Í¼ò½à£¬ÔÙ¼ÓÉϼò½àµÄº¯Êý£¬ÔÚ¿ª·¢Ð§ÂÊ¡¢Debug¡¢²âÊÔÉÏËƺõ»áÓÐÓÅÊÆ¡£
£ª ´óÐ͸´ÔÓÏîÄ¿µÄÐÔÄܸü¶àµØÌåÏÖÔڼܹ¹¡¢Ó²¼þÍØÆ˽ṹÉϵȡ£Ó¦¶Ô ......

ÍøÂçУʱ ¸½PythonÔ´Âë¼°¼¸¸ö±ê׼ʱ¼ä·þÎñÆ÷

ÍøÂçʱ¼ä·þÎñÆ÷ Ò»°ã¶¼×ñÑ­ RFC868 ЭÒé±ê×¼.
°´¸Ã±ê×¼ ¸½ÏÂÃæ Python Ô´Âë.
# -*- coding: utf-8 -*-
import socket,sys,time
#ʱ¼ä·þÎñÆ÷
host = "stdtime.gov.hk"
#¶Ë¿Ú
port = 37
#ʱÇø
curtz = 8
#Á¬½Ó·þÎñÆ÷,²¢½ÓÊÕ·µ»Ø
try:
host = socket.gethostbyname(host)
s = socket.socket(socket.AF_INET,soc ......

Python: pythonдµÄÒ»¸ö¼òµ¥ÍøÂç´Êµä

ÏÐÀ´ÎÞÊÂ, ÍæÍæpython...
ÊDzÉÓÃÓеÀ·­Òë, È»ºóץȡÍøÒ³µÄ.
import re, urllib
url="http://dict.youdao.com/search?le=eng&q="
print ("input q to exit")
while 1:
word = raw_input(">>>")
if word=="q":
exit()
else:
word = word.replace(' ', '+')
url += word
u ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ