Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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²»Í¬¡£ÕâЩÎļ ......

pylibpcap: python module for libpcap

#!/usr/bin/env python2
import pcap
import sys
import string
import time
import socket
import struct
protocols={socket.IPPROTO_TCP:'tcp',
           socket.IPPROTO_UDP:'udp',
           socket ......

PythonÐÔÄܲâÊÔº¯Êý

Python ÉçÇøÓоäË×Ó“Python ×Ô¼º´ø×ŵç³Ø¡£” ±ð×Ô¼ºÐ´¼Æʱ¿ò¼Ü¡£Python 2.3ÒÔºó ¡¢¾ß±¸Ò»¸ö½Ð×ö timeit µÄÍêÃÀ¼Æʱ¹¤¾ß¡£DiveIntoÖеÄÀý×Ó
>>> import timeit
>>> t = timeit.Timer("soundex.soundex('Pilgrim')",
... "import soundex")
>>> t.timeit() ......

pythonÖÐMySQLdbµÄ¼òµ¥Ê¹ÓÃ

¶ÔÊý¾Ý¿âµÄ²Ù×÷»ù±¾·ÖΪÈý²½£º
 
Á¬½ÓÊý¾Ý¿â
¸ù¾ÝÐèÒªÖ´ÐÐSQLÓï¾ä£¬½ÓÊÜ·µ»ØÖµ
¹Ø±ÕÁ¬½Ó
ÎÒÃÇÕý³£µÄÊý¾Ý¿âÓ¦¸Ã¶¼Àë²»¿ªÕâÈý²½£¬ÏÂÀ´ËµËµÈçºÎʹÓÃpythonÖеÄMySQLdbÄ£¿é½øÐÐÕâЩ²Ù×÷£º
Ê×ÏÈ£¬ÎÒÃÇÐèÒª°ÑMySQLdbÒýÈëµ½³ÌÐòÖÐ
 
import MySQLdb
 
È»ºó¿ªÊ¼Êý¾Ý¿â²Ù×÷
1.Êý¾Ý¿âÁ¬½Ó
conn = MySQLdb. ......

pythonÕýÔò±í´ïʽѧϰ


python ÖеÄre Ä£¿é
ÕýÔò±í´ïʽ
¾Í¸öÈ˶øÑÔ£¬Ö÷ÒªÓÃËüÀ´×öһЩ¸´ÔÓ×Ö·û´®·ÖÎö£¬ÌáÈ¡ÏëÒªµÄÐÅÏ¢
ѧϰԭÔò£º¹»ÓþÍÐУ¬ÐèÒªµÄʱºòÔÚÉîÈë
ÏÖ×ܽáÈçÏ£º
ÕýÔò±í´ïʽÖÐÌØÊâµÄ·ûºÅ£º
“.” ±íÈÎÒâ×Ö·û
“^ ” ±ístringÆðʼ
“$” ±ístring ½áÊø
“*” “+” & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ