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

pythonµÄ±àÂëÎÊÌâ

  Ç°Á½ÌìÀí½âÁËunicode¡¢utf-8¡¢gb2312ÕâЩ±àÂëÖ®¼äµÄ¹ØϵÒԺ󣬽ñÌìÖÕÓÚŪÃ÷°×ÁËÔÚpythonÀïÃæµÄ±àÂëÎÊÌâ¡£ÎÒÃÇÔÚдpython½Å±¾Ê±Èç¹ûÓÐÖÐÎĵÄ×Ö·û´®£¬ÔÚÔËÐеÄʱºòÓпÉÄܻᱨ´íÒ²ÓпÉÄÜ»á³öÏÖÂÒÂë¡£Ò»°ã¼ÓÉÏ# -*- coding:utf-8 -*-¾Í²»»á±¨´íÁË£¬µ«ÊÇ»¹¿ÉÄÜÓÐÂÒÂëÎÊÌ⣬¶øÇÒͬÑùµÄ´úÂëÔÚ²»Í¬µÄ±à¼­Æ÷ÖеóöµÄ½á¹û»¹ÓпÉÄܲ»Ò»Ñù£¬ÄãÊÇ·ñÒ²Óöµ½¹ýÕâЩÎÊÌâ¶øÇÒÀí²»ÇåÍ·Ð÷£¿Ï£ÍûÎҵĽ²½âÄÜÈÃÄã¶ÔÕâ¸öÎÊÌâÓÐÒ»¶¨µÄÀí½â¡£
  ¶ÔÓÚpythonµÄÒ»¸ö½Å±¾À´ËµÓÐÈýÖÖ±àÂ룺
1. ½Å±¾ÎļþµÄ±àÂë
    ½Å±¾±£´æʱµÄ±àÂë¸ñʽ£¬²»Í¬µÄ±à¼­Æ÷²ÉÓõĸñʽ²»Í¬»áÔì³ÉÒ»¶¨µÄ»ìÂÒ£¬Ò»°ãÊÇutf-8»òÕßcp936£¨windowsÉÏ£©
2. python½âÎöÆ÷µÄ±àÂë
    pythonĬÈÏʹÓÃascci±àÂ룬ËùÒÔÈç¹ûÄãµÄ½Å±¾ÖгöÏÖÁËÖÐÎÄ£¬ÓÃascci±àÂëÇø½âÎöÒ»¶¨»á³ö´í£¬ÒòΪascci²»Ã»ÓÐutf-8£¬cp936ÀïÃæµÄÖÐÎÄ×Ö·ûµÄ¡£ËùÒÔÄãÒªÔڽű¾µÄµÚÒ»ÐмÓÈë# -*- coding:utf-8 -*-×¢ÊÍÀ´Í¨Öªpython½âÎöÆ÷ʹÓÃutf-8£¬µ«ÊÇÕâ¸öÖ»ÊÇ֪ͨһÏÂpython¶ø²»ÊÇÕæµÄÓÃutf-8µÄ±àÂëÇø½âÎöÕâÀïµÄÖÐÎÄ×Ö·û´®¡£ÀýÈ磬ÄãдÁËÒ»¸ö½Å±¾±£´æµÄ±àÂëÊÇcp936µÄ£¬Èç¹û²»¼ÓÈë×¢ÊÍÒ»¶¨»áÔÚÔËÐÐʱ±¨´í£¬ÒòΪascci²»°üÀ¨cp936ÀïÃæµÄ×Ö·û£¬¶øÄãдÁ˵ÚÒ»ÐеÄ×¢Ê;Ͳ»»á±¨´íÁËÒòΪutf-8ÖÐÓÐÕâ¸ö×Ö·û£¬µ«ÊÇ×Ö·ûµÄº¬Òåδ±ØÊÇÄǸöÖÐÎÄ£¬Ëü½ö½öÊÇ´¦Àíһϡ£ÕâÀïÓиöµØ·½ÐèҪעÒâÈç¹ûÄãµÄ½Å±¾±£´æʱµÄ±àÂëÊÇutf-8µÄ¾Í²»ÐèÒªµÚÒ»ÐеÄ×¢ÊÍ£¬python»áÕýȷʶ±ð¡£ÎÒ¸öÈËÀí½âÊÇpythonֻʶ±ðutf-8ºÍansiÁ½ÖÖ¸ñʽµÄÎļþ£¬ansi¸ñʽµÄÐèÒªÃ÷È·Ö¸³öcoding£¬·ñÔòpythonĬÈÏʹÓÃascciÀ´´¦Àí
3. ÔËÐнű¾µÄ»·¾³µÄ±àÂë
    Èç¹ûÔËÐл·¾³µÄ±àÂë¸ñʽÓë½Å±¾ÎļþµÄ¸ñʽÏàͬ¾ÍÕýÈ·ÏÔʾ£¬²»Í¬¾ÍÊÇÂÒÂ룬ÒòΪÔËÐл·¾³»á½øÐнâÂë
»¹ÊÇ¿´¿´´úÂë°É£º
# -*- coding:utf-8 -*-   #Èç¹ûûÓÐÕâ¾ä»á±¨´í£¬Ä¬ÈϵÄascciÎÞ·¨½âÎöcp936±àÂë
# cp936±àÂë±£´æ
str = 'abcÖÐÎÄ'
print str #cmdÖÐÕýÈ·ÏÔʾ£¬ÒòΪcmdÊÇcp936±àÂë
ustr = u'abcÖÐÎÄ' #±¨´í£¬ÒòΪÎÞ·¨ÓÃutf-8µÄ¸ñʽȥ¶Ôcp936½øÐнâÂ룬
ustr1 = unicode(str, 'cp936') #ÕýÈ·£¬ ÒòΪ½âÂëÓõıàÂëÓëÎļþ´æ´¢µÄ±àÂëÏàͬ
=============================================
# utf-8±àÂë±£´æ
str = 'abcÖÐÎÄ'
print str #cmd        #²»»á±¨´íµ«ÊÇÏÔʾΪÂÒÂ룬Èç¹û·Åµ½cygwinÖÐÖ´ÐÐÏÔʾÕýÈ·£¬ÒòΪcygwinµÄbashÊÇutf-8µÄ
us


Ïà¹ØÎĵµ£º

°²×°Memcached For Win32 ºÍ Memcached Python Client

    Memcached
ÊÇdanga.com£¨ÔËÓªLiveJournalµÄ¼¼ÊõÍŶӣ©¿ª·¢µÄÒ»Ì×·Ö²¼Ê½ÄÚ´æ¶ÔÏ󻺴æϵͳ£¬ÓÃÓÚÔÚ¶¯Ì¬ÏµÍ³ÖмõÉÙÊý¾Ý¿â¸ºÔØ£¬ÌáÉýÐÔÄÜ¡£
    ÍøÉÏÓкིܶµ½Memcached For LinuxµÄ°²×°½Ì³Ì£¬µ«ÊÇMemcached For Win32 and PythonµÄ¾ÍÉõÉÙ£¬Å¼¶ûgoogleÕÒµ½Ò»Æª
±È½ÏÏà½üµÄÓ¢ÎĽ̳̣¬¾õµÃ ......

PythonÖ®ÃÀ DecoratorÉîÈëÏê½â(Ò»)

There should be one—--and preferably only one –--obvious way to do it.
                                     ......

PythonͨѶ²¾

ÕâÁ½ÌìÔÚѧϰpythonÓïÑÔ£¬Ò²Ñ§×ÅдÁ˸öͨѶ²¾£¬Á·Ï°ÈëÃÅÏ£¡
¹¦ÄÜ°üÀ¨ÒÔÏ£º
1¡¢Ôö¼ÓÒ»Ìõ¼Ç¼
2¡¢É¾³ýÒ»Ìõ¼Ç¼
3¡¢ÐÞ¸ÄÒ»Ìõ¼Ç¼
4¡¢²éѯһÌõ¼Ç¼
5¡¢ÏÔʾÕû¸öͨѶ²¾
6¡¢°ïÖúÌáʾ
7¡¢°æ±¾ÏÔʾ
8¡¢Í˳öµÈ
Ê×ÏȽ¨Á¢Ò»¸öPersonÀ࣬¼´Person.pyÎļþ£¬ÓÃÀ´±£´æÁªÏµÈ˼Ǽ£º
class Person:
def __init__(self, nam ......

Python¸ÅÊö

    Python ÊÇÃâ·ÑµÄ½âÊÍÐÔÓïÑÔ£¬¾ßÓÐÃæÏò¶ÔÏóµÄÌØÐÔ¡£¿ÉÒÔÔËÐÐÔÚ¶àÖÖ²Ù×÷ϵͳ֮ÉÏ£¬Python¾ßÓÐÇåÎúµÄ½á¹¹£¬¼ò½àµÄÓï·¨ÒÔ¼°Ç¿´óµÄ¹¦ÄÜ¡£Python¿ÉÒÔÍê³É´ÓÎı¾´¦Àíµ½ÍøÂçͨÐŵȸ÷ÖÖ¹¤×÷£¬python×ÔÉíÒѾ­ÌṩÁË´óÁ¿µÄÄ£¿éÀ´ÊµÏÖ¸÷ÖÖ¹¦ÄÜ£¬³ý´ËÒÔÍ⻹¿ÉÒÔʹÓÃC/C++À´À©Õ¹Python£¬ÉõÖÁ»¹¿ÉÒÔ½«PythonǶÈëµ½ÆäËûÓ ......

PythonÖÐreactor,factory,protocolµÄѧϰ±Ê¼Ç


PythonÖÐreactor,factory,protocolµÄѧϰ±Ê¼Ç
 
 
×îΪ¼òµ¥µÄÇé¿öÏ£¬³ýÁËÁ˽âÇåreactorµÄ¼òµ¥Ê¹Óã¬Ä㻹ҪÁ˽âProtocolºÍFactory¡£ËüÃÇ×îÖÕ¶¼»áÓÉreactorµÄÕìÌý½¨Á¢ºÍrunÀ´Í³Ò»µ÷¶ÈÆðÀ´¡£    
   
     ½¨Á¢·þÎñÆ÷µÄµÚÒ»¸öÒª½â¾öµÄÎÊÌâ¾ÍÊÇ·þÎñÓëÍâ½çµÄ½»Á÷Э ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ