ѧϰ¡¶PythonÓïÑÔÈëÃÅ¡·µÚÎåÕ ģ¿é
Ä£¿éÕⶫÎ÷ºÃÏñûʲôºÃ½²µÄ£¬ÎÞ·ÇÊDZ£´æÒ»·ÝÎļþ£¬È»ºóÔÚÁíÒ»·ÝÎļþÖÐÓÃimport ºÍfrom ** import **(*)¾ÍÐÐÁË¡£
ÕâÒ»ÕÂÖ÷Òª½²µ½ÁËϸ½Ú£¬µ¼ÈëÄ£¿éPythonÀïÃæÊÇʲô´¦ÀíµÄ£¬import ºÍ from ** import **ÓÐʲô²»Ò»Ñù¡£»¹ÓоÍÊÇÔö¼ÓÁËreload()Õâ¸öº¯ÊýµÄʹÓÃ˵Ã÷¡£
ÒÔÇ°¿´µ½ÄÄÀï˵¾¡Á¿Ê¹ÓÃimport¶ø²»ÒªÊ¹ÓÃfrom ** import **£¬Ò»Ö±²»ÖªµÀÔÒò£¬ÔÚÕâÒ»ÕÂÀïÕÒµ½Á˴𰸡£Æäʵ¾ÍÊÇPythonµ¼ÈëÄ£¿éʱÒýÓú͸³ÖµµÄÇø±ð¡£ºóÃæµÄÄ£¿é³£¼ûÎÊÌâÒ²´ÓÕâÀïÕ¹¿ª¡£
Ä£¿éÉè¼Æ¹À¼ÆÊǺÜÓÐÄѶȵĶ«Î÷£¬¿ÉϧÕâÀï½²µÃÌ«ÉÙÁË£¬Ö»Ìá³öÁË4¸öÔÔò£¬Ã»ÓÐʵ¼ÊµÄÀý×Ó¡£
ÏÂÒ»ÕµÄÀàÊǸö´óÍ·£¬ÒѾÔÚ¿´ÁË¡£×÷ÕßÓÃÁ˲»ÉÙƪ·ùдÀà¡£
Ïà¹ØÎĵµ£º
ÓÃ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()£¬·ñÔòÆäË ......
from: http://www.cnblogs.com/dahuzizyd/archive/2005/03/01/111006.html
pythonÖ§³ÖÃæÏò¶ÔÏóµÄ±à³Ì·ç¸ñ£¬ÕâÀïÖ÷Ҫ˵˵pythonÖеĶà¼Ì³Ð£º
ÏÂÃæµÄ´úÂëʹÓÃpython2.4£¬°²×°ºóʹÓÃidleµÄIDE¿ª·¢»·¾³£¨ËµÊÇIDE £¬±ÈÆðdelphi,VS.netµÈ¼òµ¥µÃÌ«¶àÁË)
´ÓFile-New²Ëµ¥½¨Á¢Ò»¸ö.pyÎļþ£¬Ð´ÏÂÃæµÄ´úÂ룺
class SuperCl ......
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()
......
¡¡¡¡ÉÏ´Îѧϰ¹ýmarshalÄ£¿éÓÃÓÚÐòÁл¯ºÍ·´ÐòÁл¯£¬µ«marshalµÄ¹¦ÄܱȽϱ¡Èõ£¬Ö»Ö§³Ö²¿·ÖÄÚÖÃÊý¾ÝÀàÐ͵ÄÐòÁл¯/·´ÐòÁл¯£¬¶ÔÓÚÓû§×Ô¶¨ÒåµÄÀàÐ;ÍÎÞÄÜΪÁ¦£¬Í¬Ê±marshal²»Ö§³Ö×ÔÒýÓÃ(µÝ¹éÒýÓÃ)µÄ¶ÔÏóµÄÐòÁл¯¡£ËùÒÔÖ±½ÓʹÓÃmarshalÀ´ÐòÁл¯/·´ÐòÁл¯¿ÉÄܲ»ÊǺܷ½±ã¡£»¹ºÃ£¬python±ê×¼¿âÌṩÁ˹¦Äܸü¼ÓÇ¿´óÇÒ¸ü¼Ó°²È«µÄpickle ......
PythonÖеÄeasy_install¹¤¾ßºÜºÃÓã¬ËüµÄ×÷ÓÃÀàËÆÓÚPhpÖеÄpear£¬»òÕßRubyÖеÄgem£¬»òÕßPerlÖеÄcpan¡£
Èç¹ûÏëʹÓÃeasy_install¹¤¾ß£¬¿ÉÒÔÖ±½Ó°²×°ez_setup.py
½Å±¾£¬ÔÙpython ez_setup.py£¨Ö®Ç°ÏÈÒª°²×°python£©£º
°²×°Íêºó£¬×îºÃÈ·±£easy_installËùÔÚĿ¼ÒѾ±»¼Óµ½PATH»·¾³±äÁ¿Àï:
Windows: C:\Python25\Scripts
Li ......