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

[Ô­´´]PythonÄÚ´æй©²é¿´Æ÷ʵÏÖ

[Ô­´´]PythonÄÚ´æй©²é¿´Æ÷ʵÏÖ
by AKara 2009-04-23 @ http://blog.csdn.net/akara @ akaras@163.com
   
---------------------------------------------------------------------
  Ϊ¸üºÃ¶¨Î»PythonÄÚ´æй©Çé¿ö£¬Ð´ÁËÒ»¸öеÄPythonÄÚ´æй©²é¿´Æ÷Ä£¿é¡£
Ä£¿éÓÐÈçϹ¦ÄÜ£º
  * ½«ËùÓжÔÏó°´¿òͼÒýÓùØϵÊä³öpngͼƬ
  * ¿Éµ÷ÕûÊä³öÿÒýÓòã½ÚµãµÄ×î´óÊýÁ¿
  * ¿Éµ÷Õû驶ÔÏóÍùÉÏÒýÓõIJã´ÎÊýÁ¿
  * ¸÷ÖÖÀàÐͶÔÏóÓÃΨһµÄÑÕÉ«±êʶ
  * 驶ÔÏóÔÚÔ­ÑÕÉ«ÉÏȾºìÉ«
  * 驶ÔÏóÏà¹ØµÄlinkÓúìÉ«ÏßÌõ/ºìÉ«ÎÄ×Ö
  * ÓÃ<>Ìرð±êʶPython¶ÔÏóµÄÌØÊâ½á¹¹linkÎÄ×Ö
  ËùÒÔ£¬¸ù¾ÝÉÏͼ£¬ÐèҪȥ³ýÄÚ´æй©Ҫ×öµÄ¹¤×÷¾ÍÊÇ¡¾Ïû³ýºìÉ«¿ò¡¿£¬
×î¼òµ¥µÄ·½Ê½ÊÇ¡¾Ïû³ýËùÓкìÉ«link¡¿£¬µ«ÕâÏÔÈ»²»ÊÇ×îÓÐЧµÄ·½·¨————
×îÓÐЧµÄ·½·¨ÊǾ¡Á¿ÇжÏ"¶¥²¿"µÄlink(Ôõô²ÅËã"¶¥²¿"£¬ÒÀÀµ¹¦ÄÜÂß¼­Åж¨)¡£
---------------------------------------------------------------------
  PythonÌṩÁËgc.get_referrers·½·¨À´»ñµÃÒ»¸ö¶ÔÏóµÄÒýÓÃÕßÁÐ±í£¬ºÜ´ó³Ì¶È
ÉÏ£¬ÕâÒѾ­Íê³ÉÁËÄ£¿éµÄ50%µÄ¹¦ÄÜÁË£ºÒòΪֻҪwhileÑ­»·È¡µ½get_referrers
²¢Èë³öË«¶Ë¶ÓÁУ¬Ö±ÖÁ´¦ÀíΪ¿Õ¼´¿É¡£
  µ«ÊÇÔÚÊä³ö¶ÔÏóÒýÓùØϵµÄÓÐÏò±ßÐÅϢʱ£¬ÐèÒª×ÐϸµØ¶ÔtypesÄ£¿éÖÐËù
¶¨ÒåµÄ¸÷ÖÖÀàÐ͵ÄPython¶ÔÏó½øÐÐÇø±ð¶Ô´ý£¬ÉõÖÁÓÐЩPythonµÄÄÚ²¿¶ÔÏóÀàÐÍ
Á¬typesÄ£¿éÖж¼Ã»¸ø³ö£¬»òÁ¬Python ManualÊÖ²áÉ϶¼²»¶à˵һ¾ä :( £º
  (1)CellType: Ò»ÖÖÓÃÓÚÖ¸Ïòupvalue(LuaÖÐÕâÑù½Ð£¬¾ÍÕâÑù³Æºô°É)µÄ¶ÔÏó£¬
       Ëü¿É±»Ò»¸ö»ò¶à¸öclousureµÄfree var tupleÒýÓá£ËäÈ»Python²»Ï£Íû
       Ê¹ÓÃÕß×¢ÒâÕâ¸öÄÚ²¿µÄ¶ÔÏóÀàÐÍ£¬µ«ÊÇ¿ÉÒÔ×Ô¼º¶¯ÊÖÈ¡µÃ£º
       CellType = type((lambda x: lambda: x)(1).func_closure[0])
       
  (2)NewStyleClassType: ¾ÍÊÇnew style class(ºÍold style classÏà¶ÔµÄ)¡£
       ·í´ÌµÄÊÇPython´ÓÒýÈënew style classÒÔÀ´¾ÍÌᳫÞðÆúold style class
       (ÎÞÂÛ´ÓÐÔÄÜÉÏ£¬·½±ãÐÔÉÏ£¬¹¦ÄܶàÑùÐÔÉÏnew style class¾ùʤ)£¬µ«ÊÇ
       


Ïà¹ØÎĵµ£º

PythonÖеÄһЩÒì³£

ÆäʵÒì³£¾ÍÊDz»Õý³££¬¾ÍÊDz»ºÍÎÒÃÇÏëÏóÒ»ÑùÈ¥Ö´ÐС£ËüÊÇÒòΪ³ÌÐò³öÏÖÁË´íÎó¶øÔÚÕý³£¿ØÖÆÁ÷ÒÔÍâ²ÉÈ¡µÄÐÐΪ¡£Python³öÏÖÒì³££¬¾ÍÊÇÒòΪ¼ì²éÁËÒ»¸ö´íÎóʱ£¬Python½âÊÍÆ÷ÎÞ·¨¼ÌÐø¼ÌÐøÖ´ÐÐÏÂÈ¥£¬ÕâʱºòÅ׳öÁËÒì³£¡£ÍùÍùÕâ¸ö´íÎó·ÖΪÓï·¨ÉϺÍÂß¼­ÉÏ(²»Éó¤Ëµ¸ÅÄ-_-! )£¬¿´¿´¼¸¸öÀý×Ó£¬×ܽáһϣº
1¡¢NameError£º³¢ÊÔ·ÃÎÊÒ»¸öÎ ......

python ¶ÁhttpС¼Ç

conn = httplib.HTTPConnection(EPG_IP + ":" + HTTP_PORT)
url = FAV_URL_PARTH +"userid=" + USER_ID + FAV_DIR_MODIFY
param = '''<ps100request id="Favorite.Category.modify">
<categoryid>'''+categoryid+'''</categoryid>
<categoryname>'''+categoryname+'''</ ......

python»æÖÆÂÝÐýÏß

#coding=utf-8
from math import sqrt,cos,sin
import Image, ImageDraw
class SpireShape(object):
    def __init__(self, draw):
        self.draw = draw
        self.line_width = 1
     & ......

·¢²¼pythonÓ¦ÓóÌÐò

¡¾windows+python3.1.2¡¿
·¢²¼pythonÓ¦ÓóÌÐòÊǸöºÜÂé·³µÄÊ£¬ÒòΪ<1>ÎÞ·¨±àÒëÔ­Éúcode<2>ÿ¸ö°æ±¾µÄ×Ö½ÚÂ벻ͬ<3>Èç¹ûÖ±½ÓÉÏÔ´Âë»áËðº¦×Ô¼ºµÄÀûÒæ——µÈµÈ
·½·¨1——ÊÖ¶¯´ò°ü
Ôõô´ò°üÄØ£¿Ò»¸öpythonÎļþ¼ÐÒª¶þÊ®¶àMB°¡£¡
yes£¡ÎÒÃǾÍÒªÇåÀíÎÞÓõĶ«Î÷£¡
ÏÈдһ¸öwin.pyÎļþ£º ......

pythonÖбàÂëת»»

µ±pythonÖм䴦Àí·ÇASCII±àÂëʱ£¬¾­³£»á³öÏÖÈçÏ´íÎó£º
UnicodeDecodeError: 'ascii' codec can't decode byte 0x?? in position 1: ordinal not in range(128)
0x??Êdz¬³ö128µÄÊý×Ö£¬pythonÔÚĬÈϵÄÇé¿öÏÂÈÏΪÓïÑԵıàÂëÊÇascii±àÂ룬ËùÒÔÎÞ·¨´¦ÀíÆäËû±àÂ룬ÐèÒªÉèÖÃpythonµÄĬÈϱàÂëΪËùÐèÒªµÄ±àÂë¡£
Ò»¸ö½â¾öµÄ·½°¸ÊÇ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ