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

×î¼òµ¥µÄ 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()


Ïà¹ØÎĵµ£º

Python3ÔÚubuntu»·¾³Ïµİ²×°

       Ê×ÏÈÏÂÔØ×îа汾µÄPython£¬ÔÚÕâÀïÎҵİ汾ÊÇPython3.1.1¡£È»ºó¾ÍÊǰ²×°£¬Çл»µ½PythonµÄÎļþĿ¼Ï£º
./configure
make
make test
sudo make install
      ÔÚÕâÀï¿ÉÄÜ»áÓöµ½¼¸¸öÎÊÌ⣬µÚÒ»¸öÊÇÔÚ./configureʱ£¬¿ÉÄÜ»á³öÏÖC compiler cannot create ......

[ת] ×î¼òµ¥µÄʹÓÃUDPͨÐŵÄPython SocketÀý×Ó

À´Ô´£º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ÉÏ´«Îļþµ½·þÎñÆ÷

#! /usr/bin/env python
# -*- coding: utf-8 -*-
from ftplib import FTP
from os import path
from optparse import OptionParser
from FtpDownload import spilt_cmd
import socket
import sys
'''
ÉÏ´«ÖÕ¶ËMRÎļþµ½·þÎñÆ÷
V1.0    zhai   2009-07-27
'''
def main():
&nbs ......

PythonÏ̱߳à³Ì£¨¶þ£©Ïß³Ìͬ²½

¶à¸öÖ´ÐÐÏ߳̾­³£Òª¹²ÏíÊý¾Ý£¬Èç¹û½ö½ö¶ÁÈ¡¹²ÏíÊý¾Ý»¹ºÃ£¬µ«ÊÇÈç¹û¶à¸öÏß³ÌÒªÐ޸Ĺ²ÏíÊý¾ÝµÄ»°¾Í¿ÉÄܳöÏÖÎÞ·¨Ô¤ÁϵĽá¹û¡£
    ¼ÙÈçÁ½¸öÏ̶߳ÔÏót1ºÍt2¶¼Òª¶ÔÊýÖµnum=0½øÐÐÔö1ÔËË㣬ÄÇôt1ºÍt2¶¼¸÷¶ÔnumÐÞ¸Ä10´ÎµÄ»°£¬ÄÇônum×îÖյĽá¹ûÓ¦¸ÃΪ20¡£µ«ÊÇÈç¹ûµ±t1È¡µÃnumµÄֵʱ£¨¼ÙÈç´ËʱnumΪ0£©£¬ÏµÍ³°Ñt1µ ......

python pyserial ´®¿Ú

ÓÃpythonдÁ˸ö×î¼òµ¥µÄ¶Á´®¿ÚµÄ³ÌÐò£¬ÒòΪ¹¤×÷Öо­³£ÐèÒª¶Á´®¿Ú
·Åԭʼ´úÂë
import serial
ser = serial.Serial('com3',baudrate=115200, bytesize=8,parity='N', stopbits=1,xonxoff=0, timeout=1)
while( True ):
    a = ser.read(100)
    print a
ÓÃÍêÐèÒªser.close()£¬·ñÔòÆäË ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ