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

ʵս¹¹½¨PythonºÍC++»ìºÏϵͳ

      ¹ØÓÚC++ºÍPythonÖ®¼ä»¥Ïàµ÷ÓõÄÎÊÌ⣬¿ÉÒÔ²éÕÒµ½ºÜ¶à×ÊÁÏ¡£±¾ÎĽ«Ö÷Òª´Ó½â¾öʵ¼ÊÎÊÌâµÄ½Ç¶È¿´ÈçºÎ¹¹½¨Ò»¸öPythonºÍC++»ìºÏϵͳ¡£
                                         Á¦Îª 2009
 
Ò»¡¢¸ÅÄî
    »ìºÏϵͳ£º²ÉÓöàÖÖÓïÑÔ¹¹½¨µÄϵͳ¡£±ÈÈçNative C++ºÍdotNetµÄ»ìºÏϵͳ£¬Python/LuaºÍC++µÄ»ìºÏϵͳ¡£
PythonºÍC++¸÷Óи÷µÄÓÅȱµã£¬¹¹½¨Á½Õß»ìºÏϵͳµÄÖ÷ҪĿµÄ¾ÍÊÇÀûÓÃPythonµÄÁé»îÐÔºÍC++¸ßЧÐÔ£¬Ôö¼Ó³ÌÐòµÄÀ©Õ¹ÐÔ¡£µ±È»»¹ÓÐÆäËûºÃ´¦£¬´Ë´¦¾Í²»Õ¹¿ªÌ¸ÁË¡£½Å±¾ÓïÑÔÓкܶ࣬ÖÁÓÚΪʲô²»²ÉÓÃÆäËûµÄ£¨ÈçLua¡¢RubyµÈ£©£¬ÕâÀïÒ²²»¿¼ÂÇ¡£½Å±¾ÓïÑԵIJÉÓÃÖ÷ÒªÊǸöÈËϲºÃµÄÎÊÌâ¡£²ÉÓÃLua¿ÉÒԲ鵽ºÜ¶à×ÊÁÏ£¬ÒÔÇ°Ò²ÔøÓÃLuaBindʵÏÖ¹ý¡£
      
¶þ¡¢ÏµÍ³¼Ü¹¹
       »ìºÏϵͳ¿ÉÒÔ¼ò»¯³ÉÈçÏÂÄ£ÐÍ£º
 
 
 
ϵͳµÄÔËÐйý³ÌΪ£º
Ê×ÏÈÔÚÓ¦ÓóÌÐòÖÐǶÈë½Å±¾ÓïÑÔ½âÎöÆ÷£¬È»ºóÓýű¾ÓïÑÔÌṩµÄC/C++ API·â×°ÒÑÓеÄC++¹¦Äܿ⣬ÔÙÓýű¾µ÷Ó÷â×°µÄ·þÎñ¡£´Ëºó£¬Ó¦Óòã±ã¿ÉÒÔÖ´Ðнű¾ÀïµÄÄÚÈÝ£¬ÆäЧ¹ûÓëÓ¦ÓòãÖ±½Óµ÷Ó÷þÎñ²ãÀàËÆ¡£
 
Èý¡¢ÊµÏÖ
±¾ÀýÖвÉÓýű¾ÓïÑÔPython£¬Òò´ËÖ÷Òª¹¤×÷ΪÔÚÓ¦ÓòãǶÈëPython½âÎöÆ÷£¬ÓÃPython·â×°·þÎñ²ã¡£ÎªÁË˵Ã÷ÎÊÌ⣬ӦÓòãµÄʵÏÖΪPythonConsole.ex£¬·þÎñ²ãµÄʵÏÖΪMythma.dll£¬·â×°²ãΪMythmaPy.dll¡£
 
 
 
1¡¢¼Ù¶¨Mythma.dllÖеÄÒ»¸öÀàΪCHelloWorld£º
 
class MythmaAPI CHelloWorld
{
public:
   CHelloWorld(void);
   ~CHelloWorld(void);
   void SetId(int nId) { m_Id = nId;}
   int  GetId() const { return m_Id; }
private:
   int m_Id;
};
 
 
2¡¢ÏÖÔÚÓÃBoost.Python·â×°¸ÃÀࣺ
#include "HelloWorld.h"
#include <boost/python.hpp>
using namespace boost::python;
BOOST_PYTHON_MODULE(My


Ïà¹ØÎĵµ£º

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()£¬·ñÔòÆäË ......

×î¼òµ¥µÄ 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 »ñÈ¡E

E-mailÖ÷ÒªÓÉÓʼþÍ·ºÍÓʼþÌåÁ½²¿·Ö×é³É¡£
ÓʼþÍ·ÖеÄÄÚÈݺÍÎÒÃǼÄÐÅʱдÔÚÐÅ·âÉϵÄÄÚÈÝ´óͬСÒ⣬µ±È»ÕâÀïÒ²°üº¬Á˺ܶà·¹ýµÄ“Óʾ֔µÄÐÅÏ¢ÁË¡£
ÓʼþÌåÖеÄÄÚÈݾÍÊÇÎÒÃÇдµÄÐÅ»òÕß°ü¹ü¡£
python×ÔÉí°üº¬ÁËemailÄ£¿é´¦Àí¿ÉÒÔ¿ìËٵĴ¦ÀíE-mailÖеÄÐÅÏ¢
import email
#´ò¿ªÒ»¸öÎļþ
fp = open('email.eml', ' ......

Python Ascii to bcd bcd to Ascii

ÔÚÍøÉÏËѲ»µ½¹ØÓÚ Ascii ºÍ bcd»¥Ïàת»¯µÄÎÄÕ£¬ÓÚÊÇ×Ô¼ºÐ´ÁËÒ»¸ö£¬ºÍ´ó¼Ò·ÖÏíÏ¡£
ûÓп¼Âǵ½Ð§ÂÊ£¬Äܹ»ÓÅ»¯µÄµØ·½Íû´ó¼ÒÌá³ö
"""
    AscII×Ö·ûת»»ÎªBCD×Ö·û
"""
def asc2bcd(inAsc, pad_L0_R1 = 0):
#È«²¿×ª»»Îª´óд£¬ÎªºóÃæµÄת»»Ìṩ·½±ã
    inAsc = inAsc.upper()
 &nb ......

MoteLab£º·µ»Ø´®¿ÚÊý¾Ý´¦Àí£¨python£©

´ÓMoteLab·µ»ØµÄ´®¿ÚÊý¾Ý£¬°üº¬messages.pickleÎļþÕâÊÇMoteLabϵͳÖд®¿ÚÊÕ¼¯Êý¾ÝµÄ×ܺͣ¬µ«ÊÇÕâЩÊý¾ÝÐèÒª½âÎöºó²ÅÄܽøÐзÖÎö¡£ÏÂÃæµÄ´úÂë¾ÍÊÇÔÚpython»·¾³ÏÂÌáÈ¡messageÓÐЧÊý¾ÝµÄ´úÂë¡£
ʹÓÃÃüÁî python TestOutput.py messages.pickle
Éú³ÉµÄtest.log¾ÍÊÇ»ñµÃµÄÓÐЧÊý¾Ý
·µ»ØÊý¾ÝµÄʾÀý
1252985727.66  recei ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ