×î¼òµ¥µÄ python ¶àÏß³ÌʾÀý
import time,thread
def test(a,b):
for i in range(a,b):
time.sleep(1)
print i
def start():
thread.start_new_thread(test,(1,1001))
thread.start_new_thread(test,(1000,2001))
if __name__=='__main__':
start()
Ïà¹ØÎĵµ£º
¡¡¡¡Python±ê׼ģ¿éÖУ¬Óжà¸öÄ£¿éÓÃÓÚÊý¾ÝµÄѹËõÓë½âѹËõ£¬Èçzipfile£¬gzip, bz2µÈµÈ¡£ÉϴνéÉÜÁËzipfileÄ£¿é£¬½ñÌì¾ÍÀ´½²½²zlibÄ£¿é¡£ zlib.compress(string[, level]) zlib.decompress(string[, wbits[, bufsize]]) ¡¡¡¡zlib.compressÓÃÓÚѹËõÁ÷Êý¾Ý¡£²ÎÊýstringÖ¸¶¨ÁËҪѹËõµÄÊý¾ÝÁ÷£¬²ÎÊýlevelÖ¸¶¨ÁËѹËõµÄ¼¶±ð£¬ËüµÄÈ ......
Ê×ÏÈÏÂÔØ×îа汾µÄPython£¬ÔÚÕâÀïÎҵİ汾ÊÇPython3.1.1¡£È»ºó¾ÍÊÇ°²×°£¬Çл»µ½PythonµÄÎļþĿ¼Ï£º
./configure
make
make test
sudo make install
ÔÚÕâÀï¿ÉÄÜ»áÓöµ½¼¸¸öÎÊÌ⣬µÚÒ»¸öÊÇÔÚ./configureʱ£¬¿ÉÄÜ»á³öÏÖC compiler cannot create ......
À´Ô´£ºhttp://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
¿Í»§¶Ë³ÌÐò´úÂ룺
# Client program
from socket import *
# Set the socket parameters
host = "localhost"
port = 21567
buf = 1024
addr = (host,port)
# Create socket
UDPSock = socket(AF_INET,SOCK_DGRAM)
......
Python
µÄ
C/C++
À©Õ¹
By phidoit@gmail.com
¿ÉÀ©Õ¹ÐÔÊÇ
Python
µÄÒ»´óÌØÉ«£¬Ò»·½Ã棬ÓÉÓÚ
Python
ÊǽâÊÍÖ´Ðеģ¬Õâµ¼ÖÂÔËÐÐËÙ ......
¶à¸öÖ´ÐÐÏ߳̾³£Òª¹²ÏíÊý¾Ý£¬Èç¹û½ö½ö¶ÁÈ¡¹²ÏíÊý¾Ý»¹ºÃ£¬µ«ÊÇÈç¹û¶à¸öÏß³ÌÒªÐ޸Ĺ²ÏíÊý¾ÝµÄ»°¾Í¿ÉÄܳöÏÖÎÞ·¨Ô¤ÁϵĽá¹û¡£
¼ÙÈçÁ½¸öÏ̶߳ÔÏót1ºÍt2¶¼Òª¶ÔÊýÖµnum=0½øÐÐÔö1ÔËË㣬ÄÇôt1ºÍt2¶¼¸÷¶ÔnumÐÞ¸Ä10´ÎµÄ»°£¬ÄÇônum×îÖյĽá¹ûÓ¦¸ÃΪ20¡£µ«ÊÇÈç¹ûµ±t1È¡µÃnumµÄֵʱ£¨¼ÙÈç´ËʱnumΪ0£©£¬ÏµÍ³°Ñt1µ ......