ÊÖ¶¯ÖÆ×÷pythonµÄexe¿ÉÖ´ÐгÌÐò
1. ÊÖ¶¯ÖÆ×÷pythonµÄexe¿ÉÖ´ÐгÌÐò
תÔØ---------------
PythonûÓÐÄÚ½¨Ò»¸ö±àÒëΪexeµÄ¹¦ÄÜ¡£¸øpython³ÌÐòµÄ²¿Êð´øÀ´²»ÉÙµÄÂé·³¡£
ËùÒԾͻá³öÏÖһЩpy2exeÖ®ÀàµÄºÜ²»´íµÄ¹¤¾ß£¬ÓÃÓÚ×Ô¶¯°Ñ.pyÎļþ±àÒëΪ.exeÎļþ¡£
×î½ü³é¿ÕÑо¿ÁËÒ»ÏÂÊÖ¶¯ÊµÏÖÀàËÆpy2exeµÄ¹¦ÄÜ£¬Ï£Íû¼ÓÇ¿¶ÔpythonµÄÁ˽⡣
½á¹û»¹Ï൱²»´í¡£°Ñ½á¹û¼Ç¼ÏÂÀ´£¬Óë´ó¼Ò¹²Ïí¡£
1.1. ÔÀí
ÎÄÖÐËùÃèÊöµÄ·½·¨£¬»ùÓÚpythonµÄÒÔϼ¸¸ö¹¦ÄÜ
1. python³ÌÐòÔËÐÐʱ£¬»áÔÚsys.pathÖ¸¶¨µÄ·¾¶ÖвéÕÒ¿âÎļþ¡£
2. python´Ó2.3¿ªÊ¼£¬Ö§³Ö´ÓzipÎļþÖÐimport¿â(Ö§³Ö.py,.pycºÍ.pyo£¬µ«²»Ö§³Ö.pyd)
3. pythonÌṩC API£¬ÈÃcÓïÑԵijÌÐò£¬¿ÉÒԺܷ½±ãµÄµ÷ÓÃpythonµÄ³ÌÐò
1.2. ʵ¼Ê²½Öè
×¢£º¼ÙÉèpython°²×°ÔÚc:\python25Ŀ¼ÖУ¬×îºóµÄ¿ÉÖ´ÐÐÎļþ·Åµ½d:\distĿ¼ÖÐ
1. ÏÈÈ¥c:\python25\LibĿ¼£¬°ÑËùÓÐÎļþ¶¼¸´ÖƳöÀ´£¬±ÈÈ縴ÖƵ½d:\pythonlibĿ¼ÖÐ
2. ¿ªÒ»¸öcmd´°¿Ú£¬½øÈëd:\pythonlibĿ¼ÖУ¬ÔËÐÐ python -OO compileall.py -f . °ÑlibÖеÄ.pyÎļþ¶¼±àÒë³É.pyoÎļþ
3. ɾ³ýd:\pythonlibĿ¼ÖÐËùÓеÄ.pyºÍ.pycÎļþ£¬ÒòΪÎÒÃÇÖ»ÒªÓÐ.pyoÎļþ¾Í¿ÉÒÔÈÃÕâЩ¿âÔËÐÐÁË¡£
4. ɾ³ýĿ¼ÖÐËùÓÐÓò»×ŵÄÎļþ£¬±ÈÈçcurses£¬test£¬idlelib£¬msilibµÈ£¬ÒÔ¼õÉÙÉú³ÉÎļþµÄÌå»ý¡£
5. °ÑÕâЩ¿â´ò°ü³ÉÒ»¸özipÎļþ£¬±ÈÈçstdlib.zip£¬·Åµ½d:\distĿ¼ÖÐ
6. °Ñc:\python25\dllsĿ¼ÖеÄ.pydºÍ.dllÎļþ£¬¸´ÖƵ½d:\dist\dllsĿ¼ÖУ¬µ±È»£¬É¾³ý²»¿ÉÄÜÓõ½µÄһЩÎļþ_msi.pyd,_ssl.pydµÈµÈ£¬¿ÉÒÔ¼õÉÙÎļþµÄÌå»ý
7. °Ñ×Ô¼ºÐ´µÄ³ÌÐò£¬Ò²°´²½Öè2ÖÁ²½Öè5Ëù˵µÄ·½·¨£¬´ò³ÉÒ»¸ömysrc.zip°ü£¬·Åµ½d:\distĿ¼ÖС£ ×¢Ò⣺×Ô¼ºÐ´µÄ³ÌÐòµÄÈë¿ÚÓ¦¸ÃÊÇmain.pyoÎļþ
8. ÓÃÒÔÏÂC³ÌÐò±àÒë³öÒ»¸ö¿ÉÖ´ÐÐÎļþ£¬±È·½Ëµ½Ðrunpy.exe£¬Ò²·Åµ½d:\distÖС£
#include <Python.h>
#include <Windows.h>
int main()
{
// µÃµ½µ±Ç°¿ÉÖ´ÐÐÎļþËùÔÚµÄĿ¼
char szPath[10240];
char szCmd[10240];
GetModuleFileName(NULL, szPath, sizeof(szPath));
char* p = strrchr(szPath,
Ïà¹ØÎĵµ£º
1¡¢strÀàÐÍ¿ÉÒÔÀí½âΪһ¸ö¶þ½øÖÆblock£¬»òmultibyte
2¡¢multibyte_str.decode("<multibyte_encode_method>") -> unicode
3¡¢unicode_str.encode("<multibyte_encode_method>") -> multibyte_str(binary block)
4¡¢unicode_str µÄ²Ù×÷²ÎÊýҲӦΪunicode£¬È磺unicode_str.find("Ñù±¾".deco ......
PythonÖÐreactor,factory,protocolµÄѧϰ±Ê¼Ç
×îΪ¼òµ¥µÄÇé¿öÏ£¬³ýÁËÁ˽âÇåreactorµÄ¼òµ¥Ê¹Óã¬Ä㻹ҪÁ˽âProtocolºÍFactory¡£ËüÃÇ×îÖÕ¶¼»áÓÉreactorµÄÕìÌý½¨Á¢ºÍrunÀ´Í³Ò»µ÷¶ÈÆðÀ´¡£
½¨Á¢·þÎñÆ÷µÄµÚÒ»¸öÒª½â¾öµÄÎÊÌâ¾ÍÊÇ·þÎñÓëÍâ½çµÄ½»Á÷Ð ......
Ç°Á½ÌìÀí½âÁËunicode¡¢utf-8¡¢gb2312ÕâЩ±àÂëÖ®¼äµÄ¹ØϵÒԺ󣬽ñÌìÖÕÓÚŪÃ÷°×ÁËÔÚpythonÀïÃæµÄ±àÂëÎÊÌâ¡£ÎÒÃÇÔÚдpython½Å±¾Ê±Èç¹ûÓÐÖÐÎĵÄ×Ö·û´®£¬ÔÚÔËÐеÄʱºòÓпÉÄܻᱨ´íÒ²ÓпÉÄÜ»á³öÏÖÂÒÂë¡£Ò»°ã¼ÓÉÏ# -*- coding:utf-8 -*-¾Í²»»á±¨´íÁË£¬µ«ÊÇ»¹¿ÉÄÜÓÐÂÒÂëÎÊÌ⣬¶øÇÒͬÑùµÄ´úÂëÔÚ²»Í¬µÄ±à¼Æ÷ÖеóöµÄ½á¹û ......
Python£¬¼òµ¥µÄÁ¦Á¿
¶¹°êÍø¶Ô»¥ÁªÍøÓû§À´ËµÊÇÖªÃûµÄWeb 2.0ÉçÇø£¬µ«¶Ô¿ª·¢Õ߶øÑÔ£¬¸üÖØÒªµÄÊÇÒ»¸öÓ¦ÓÃPython´òÔìµÄ·Ç³£³É¹¦µÄWeb 2.0Õ¾µã¡£
Pythonµ®ÉúÒÑÓÐ20ÄêµÄÀúÊ·£¬Ä¿Ç°¹úÄÚµÄPython·¢Õ¹×´¿öÈçºÎ£¿ÓëÆäËûÓïÑÔ£¨Æ½Ì¨£©Ïà±È£¬PythonÓÐÄÄЩÏÔ¶øÒ×¼ûµÄÓŵ㣿¶¹°êÓ¦ÓÃPython½øÐÐWeb¿ª·¢ÓÐÄÄЩ³É¹¦¾Ñé¿ÉÒÔ½è¼ø£¿´ø×ÅÕâЩΠ......
list.append(item)
list.extend(sequence)
http://docs.python.org/tutorial/datastructures.html
http://docs.python.org/library/functions.html Õ⼸Ìì¿´Ò»ÏÂ
python howto
¶÷¡£python documentation ȷʵºÜºÃºÜÇ¿´ó°¡£¡
list.append(x)Add an item to the end of the list; equivalent to a[len(a):]&n ......