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

ÓÃCÓïÑÔÀ©Õ¹PythonµÄ¹¦ÄÜ


Ô­ÎÄ
PythonºÍC·Ö±ðÓÐן÷×ÔµÄÓÅȱµã£¬ÓÃPython¿ª·¢³ÌÐòËٶȿ죬¿É¿¿ÐԸߣ¬²¢ÇÒÓÐÐí¶àÏÖ³ÉÄ£¿é¿É¹©Ê¹Ó㬵«Ö´ÐÐËÙ¶ÈÏà¶Ô½ÏÂý£»CÓïÑÔÔòÕýºÃÏà·´£¬ÆäÖ´ÐÐËٶȿ죬µ«¿ª·¢Ð§Âʵ͡£ÎªÁ˳ä·ÖÀûÓÃÁ½ÖÖÓïÑÔ¸÷×ÔµÄÓŵ㣬±È½ÏºÃµÄ×ö·¨ÊÇÓÃPython¿ª·¢Õû¸öÈí¼þ¿ò¼Ü£¬¶øÓÃCÓïÑÔʵÏÖÆä¹Ø¼üÄ£¿é¡£±¾ÎĽéÉÜÈçºÎÀûÓÃCÓïÑÔÀ´À©Õ¹PythonµÄ¹¦ÄÜ£¬²¢¸¨ÒÔ¾ßÌåµÄʵÀý½²ÊöÈçºÎ±àдPythonµÄÀ©Õ¹Ä£¿é¡£
Ò»¡¢¼ò½é
PythonÊÇÒ»ÃŹ¦ÄÜÇ¿´óµÄ¸ß¼¶½Å±¾ÓïÑÔ£¬ËüµÄÇ¿´ó²»½ö±íÏÖÔÚÆä×ÔÉíµÄ¹¦ÄÜÉÏ£¬¶øÇÒ»¹±íÏÖÔÚÆäÁ¼ºÃµÄ¿ÉÀ©Õ¹ÐÔÉÏ£¬ÕýÒòÈç´Ë£¬PythonÒѾ­¿ªÊ¼Êܵ½Ô½À´Ô½¶àÈ˵ÄÇàíù£¬²¢ÇÒ±»ÂÅÂųɹ¦µØÓ¦ÓÃÓÚ¸÷Àà´óÐÍÈí¼þϵͳµÄ¿ª·¢¹ý³ÌÖС£
ÓëÆäËüÆÕͨ½Å±¾ÓïÑÔÓÐËù²»Í¬£¬Python³ÌÐòÔ±¿ÉÒÔ½èÖúPythonÓïÑÔÌṩµÄAPI£¬Ê¹ÓÃC»òÕßC++À´¶ÔPython½øÐй¦ÄÜÐÔÀ©Õ¹£¬´Ó¶ø¼´¿ÉÒÔÀûÓÃPython·½±ãÁé»îµÄÓï·¨ºÍ¹¦ÄÜ£¬ÓÖ¿ÉÒÔ»ñµÃÓëC»òÕßC++¼¸ºõÏàͬµÄÖ´ÐÐÐÔÄÜ¡£Ö´ÐÐËÙ¶ÈÂýÊǼ¸ºõËùÓнű¾ÓïÑÔ¶¼¾ßÓеĹ²ÐÔ£¬Ò²ÊDZ¶ÊÜÈËÃÇÖ¸ÔðµÄÒ»¸öÖØÒªÒòËØ£¬PythonÔòͨ¹ýÓëCÓïÑÔµÄÓлú½áºÏÇÉÃîµØ½â¾öÁËÕâÒ»ÎÊÌ⣬´Ó¶øʹ½Å±¾ÓïÑÔµÄÓ¦Ó÷¶Î§µÃµ½Á˺ܴóÀ©Õ¹¡£
ÔÚÓÃPython¿ª·¢Êµ¼ÊÈí¼þϵͳʱ£¬ºÜ¶àʱºò¶¼ÐèҪʹÓÃC/C++À´¶ÔPython½øÐÐÀ©Õ¹¡£×î³£¼ûµÄÇé¿öÊÇÄ¿Ç°ÒѾ­´æÔÚÒ»¸öÓÃC±àдµÄ¿â£¬ÐèÒªÔÚPythonÓïÑÔÖÐʹÓøÿâµÄijЩ¹¦ÄÜ£¬´Ëʱ¾Í¿ÉÒÔ½èÖúPythonÌṩµÄÀ©Õ¹¹¦ÄÜÀ´ÊµÏÖ¡£´ËÍ⣬ÓÉÓÚPython´Ó±¾ÖÊÉϽ²»¹ÊÇÒ»Öֽű¾ÓïÑÔ£¬Ä³Ð©¹¦ÄÜÓÃPythonʵÏÖ¿ÉÄܺÜÄÑÂú×ãʵ¼ÊÈí¼þϵͳ¶ÔÖ´ÐÐЧÂʵÄÒªÇ󣬴ËʱҲ¿ÉÒÔ½èÖúPythonÌṩµÄÀ©Õ¹¹¦ÄÜ£¬½«ÕâЩ¹Ø¼ü´úÂë¶ÎÓÃC»òÕßC++ʵÏÖ£¬´Ó¶øÌṩ³ÌÐòµÄÖ´ÐÐÐÔÄÜ¡£
±¾ÎÄÖ÷Òª½éÉÜPythonÌṩµÄCÓïÑÔÀ©Õ¹½Ó¿Ú£¬ÒÔ¼°ÈçºÎʹÓÃÕâЩ½Ó¿ÚºÍC/C++ÓïÑÔÀ´¶ÔPython½øÐй¦
ÄÜÐÔÀ©Õ¹£¬²¢¸¨ÒÔ¾ßÌåµÄʵÀý½²ÊöÈçºÎʵÏÖPythonµÄ¹¦ÄÜÀ©Õ¹¡£
»ØÒ³Ê×
¶þ¡¢PythonµÄCÓïÑÔ½Ó¿Ú
PythonÊÇÓÃCÓïÑÔʵÏÖµÄÒ»Öֽű¾ÓïÑÔ£¬±¾Éí¾ßÓÐÓÅÁ¼µÄ¿ª·ÅÐԺͿÉÀ©Õ¹ÐÔ£¬²¢ÌṩÁË·½±ãÁé»îµÄÓ¦ÓóÌÐò½Ó¿Ú(API)£¬´Ó¶øʹµÃC/C++³ÌÐòÔ±Äܹ»ÔÚ¸÷¸ö¼¶±ðÉ϶ÔPython½âÊÍÆ÷µÄ¹¦ÄܽøÐÐÀ©Õ¹¡£ÔÚʹÓÃC/C++¶ÔPython½øÐй¦ÄÜÀ©Õ¹Ö®Ç°£¬±ØÐëÊ×ÏÈÕÆÎÕPython½âÊÍËùÌṩµÄCÓïÑÔ½Ó¿Ú¡£
2.1 Python¶ÔÏó(PyObject)
PythonÊÇÒ»ÃÅÃæÏò¶ÔÏóµÄ½Å±¾ÓïÑÔ£¬ËùÓеĶÔÏóÔÚPython½âÊÍÆ÷Öж¼±»±íʾ³ÉPyObject£¬PyObject½á¹¹°üº¬Python¶ÔÏóµÄËùÓгÉÔ±Ö¸Õ룬²¢ÇÒ¶ÔPython¶ÔÏóµÄÀàÐÍÐÅÏ¢ºÍÒýÓüÆÊý½øÐÐά»¤¡£ÔÚ½øÐÐPythonµÄÀ©Õ¹±à³Ìʱ£¬Ò»µ©ÒªÔÚC»òÕßC++ÖжÔPython¶ÔÏó½øÐд¦Àí£¬


Ïà¹ØÎĵµ£º

CÓïÑÔÊý×é


ÔÚ³ÌÐòÉè¼ÆÖУ¬ÎªÁË´¦Àí·½±ã£¬°Ñ¾ßÓÐÏàͬÀàÐ͵ÄÈô¸É±äÁ¿°´ÓÐÐòµÄÐÎʽ×éÖ¯ÆðÀ´¡£ÕâЩ°´ÐòÅÅÁеÄͬÀàÊý¾ÝÔªËصļ¯ºÏ³ÆΪÊý×é¡£ÔÚ£ÃÓïÑÔÖУ¬Êý×éÊôÓÚ¹¹ÔìÊý¾ÝÀàÐÍ¡£Ò»¸öÊý×é¿ÉÒÔ·Ö½âΪ¶à¸öÊý×éÔªËØ£¬ÕâЩÊý×éÔªËØ¿ÉÒÔÊÇ»ù±¾Êý¾ÝÀàÐÍ»òÊǹ¹ÔìÀàÐÍ¡£Òò´Ë°´Êý×éÔªËصÄÀàÐͲ»Í¬£¬Êý×éÓÖ¿É·ÖΪÊýÖµÊý×é¡¢×Ö·ûÊý×é¡¢Ö¸ÕëÊý×é¡¢½á¹ ......

CÓïÑÔº¯Êý£¨¶þ£©

¡¾Àý8.6¡¿HanoiËþÎÊÌâ
    Ò»¿é°åÉÏÓÐÈý¸ùÕ룬A£¬B£¬C¡£AÕëÉÏÌ×ÓÐ64¸ö´óС²»µÈµÄÔ²ÅÌ£¬´óµÄÔÚÏ£¬Ð¡µÄÔÚÉÏ¡£Èçͼ5.4Ëùʾ¡£Òª°ÑÕâ64¸öÔ²ÅÌ´ÓAÕëÒƶ¯CÕëÉÏ£¬Ã¿´ÎÖ»ÄÜÒƶ¯Ò»¸öÔ²ÅÌ£¬Òƶ¯¿ÉÒÔ½èÖúBÕë½øÐС£µ«ÔÚÈκÎʱºò£¬ÈκÎÕëÉϵÄÔ²Å̶¼±ØÐë±£³Ö´óÅÌÔÚÏ£¬Ð¡ÅÌÔÚÉÏ¡£ÇóÒƶ¯µÄ²½Öè¡£
±¾ÌâËã·¨·ÖÎöÈçÏ£¬ÉèAÉÏ ......

CÓïÑÔÖ¸Õ루Èý£©

¡¾Àý10.21¡¿ÓÃÑ¡Ôñ·¨¶Ô10¸öÕûÊýÅÅÐò¡£
main()
{int *p,i,a[10]={3,7,9,11,0,6,7,5,4,2};
printf("The original array:\n");
for(i=0;i<10;i++)
   printf("%d,",a[i]);
printf("\n");
p=a;
sort(p,10);
for(p=a,i=0;i<10;i++)
{printf("%d ",*p);p++;}
printf("\n");
}
sort(int x[],int n)
......

CÓïÑÔλÔËËã

Ç°Ãæ½éÉܵĸ÷ÖÖÔËË㶼ÊÇÒÔ×Ö½Ú×÷Ϊ×î»ù±¾Î»½øÐеġ£ µ«Ôںܶàϵͳ³ÌÐòÖг£ÒªÇóÔÚλ(bit)Ò»¼¶½øÐÐÔËËã»ò´¦Àí¡££ÃÓïÑÔÌṩÁËλÔËËãµÄ¹¦ÄÜ£¬ÕâʹµÃ£ÃÓïÑÔÒ²ÄÜÏñ»ã±àÓïÑÔÒ»ÑùÓÃÀ´±àдϵͳ³ÌÐò¡£
12.1 λÔËËã·û£ÃÓïÑÔÌṩÁËÁùÖÖλÔËËã·û£º
    &          °´ ......

CµÄÀúÊ·

CµÄÓÉÀ´
CÓïÑÔÊÇÓÉUNIXµÄÑÐÖÆÕßDennis RitchieºÍKen ThompsonÓÚ1970ÄêÑÐÖƳöµÄBÓïÑԵĻù´¡ÉÏ·¢Õ¹ºÍÍêÉÆÆðÀ´µÄ.
CµÄÌصã
CÓïÑÔÊÇÒ»ÖÖÃæÏò¹ý³ÌµÄÓïÑÔ,ͬʱ¾ßÓлã±àÓïÑԺ͸߼¶ÓïÑÔµÄÓŵã.CÓïÑÔ¿ÉÒԹ㷺ӦÓÃÓÚ²»Í¬µÄ²Ù×÷ϵͳ,ÈçUNIX,DOS,Windows¼°LinuxµÈ.
CµÄ·¢Õ¹
1973Äê,CÓïÑÔµÚÒ»´Î±»ÓÃÀ´±àд²Ù×÷ϵͳ(Unix)µÄÄÚºË.Denn ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ