python:È«¾Ö±äÁ¿µÄÎÊÌ⣿
³ÌÐò½á¹¹ÈçÏ£º
#¶¨ÒåÁËÈ«¾Ö±äÁ¿A
A=0
#class´¦ÀíA
class b
global A
A
#mainÀï¸øA¸³Öµ
A = 1
³ÌÐòÖ´ÐÐʱ·¢ÏÖclassÀïAµÄÖµ»¹ÊÇ0
ÐÂÊÖÓм¸¸öÎÊÌ⣺
1¡¢python³ÌÐòÖ´ÐеÄ˳Ðò£¬Èç±¾Àý,ÓÉÖ´Ðнá¹û¿´£¬ÊÇ˳ÐòÖ´ÐУ¿
2¡¢ÏëÔÚclassÀï´¦ÀíÔÚ±»mail¸³ÖµºóµÄA£¬ÈçºÎ²ÅÄÜʵÏÖ£¿
3¡¢Èç¹û2Ðв»Í¨£¬ÓÐʲô·½·¨¿ÉÒÔ×öµ½£¿
лл¡£
±äÁ¿µÄÖ´ÐÐ˳ÐòΪ¾Ö²¿¿Õ¼ä->È«¾Ö¿Õ¼ä->ÄÚ½¨¿Õ¼ä;
ËùÒÔÔÚmainÀï¸øA¸³Öµ£¬Ö»ÊǶ¨ÒåÁËÒ»¸ö¾Ö²¿±äÁ¿
³ÌÐòÖ´ÐÐ˳ÐòÒª¿´Äã´ÓÄĸöº¯Êýµ÷ÓýøÈë
¿ÉÒÔ´ÓmainÖд«²ÎÊýµ½ÀàÖеķ½·¨°¡
Python code:
class b
global A
A
ÕâÑù¶¨ÒåµÄAÊÇÔÚ±àÒëʱ¾ÍÖ´ÐеÄ, ¶ø²»ÊÇÔËÐÐʱ.
ÕâÑù¿¼ÂÇ, ¸öÀàb¶¨ÒåÒ»¸ö·½·¨µÄʱºò, Ò²ÊÇÔÚºÍAͬһ¼¶±ðµÄ´úÂëÉÏдµÄ, Èç¹ûÕâÖÖ¶«Î÷Ò²ÔËÐÐʱִÐÐ, Ôõôȷ¶¨bµÄ·½·¨? ÈçÏÂ:
Python code:
class b:
global A
A
def t(): #Õâ¸ö¼¶±ðµÄ´úÂë¶¼²»ÊÇÔËÐÐʱ²ÅÖ´ÐеÄ....
pass
Ïà¹ØÎÊ´ð£º
ÓźñµÄ¸å³ê£¬³ÏÕÐPython¼¼ÊõÈËÔ±²ÎÓë¸÷ÖÖ¼¼ÊõÊé¼®³ö°æ¡£
ͨ¹ý¸ÃÊé¼®£¬×÷Õß¿ÉÒԵõ½Èçϱ¨³ê£º
1¡¢·áºñµÄ¸å³ê¡£
2¡¢Êé¼®Öø×÷µÄÊðÃûȨ¡£
3¡¢¶Ô×÷ÕߺÍÊé½øÐÐÐû´«£¬Ìá¸ß×÷ÕßÔÚ¼¼ÊõȦ×ÓÀ ......
´ó¼ÒºÃ£¬ÎÒÊÇÒ»¸öÐÂÊÖ£¬¸Õ¿ªÊ¼Ñ§python£¬µ«ÊǸտªÊ¼µÄhelloworld¶¼Ã»·¨´òÓ¡£¬ÈÃÎÒºÜÎÞÄΡ£
ÎÒµÄpython°²×°Â·¾¶Îªf:\python31¡£ÔÚpathÖÐÒ²ÉèÖöÔÁË£¬ÔÚwindowsÏÂÔËÐÐÊÇÕâÑùÏÔʾµÄ£¬Ï£Íû¸÷λǰ±²Ö¸µãһϡ£Ð»Ð»
Pyth ......
¸Õ¸ÕÂòÁËÒ»±¾¡¶PythonºËÐıà³Ì¡·£¬¿ªÊ¼Ñ§Ï°python¡£´ó¼Ò¶à¶àÖ¸½Ì
µç×ÓÊé¾ÍºÜ¶à¡£¡£¡£
¡¶PythonºËÐıà³Ì¡·ÕâÊéµÄµÚÒ»°æ»¹ÊDz»´íµÄ£¬µÚ¶þ°æºÜ²»Õ¦µÄ£¬ÕæµÄ¡£
¸öÈ˵ÄÒâ¼ûÊÇ£º³õѧÓá¶Dive in Python¡·£¬ ......
pythonµÄPIL¿â×Ô´øµÄ·½·¨Ö»ÄܽøÐоØÐεÄÇиÈç¹ûÎÒÓÐÁËÒ»¸ö¶à±ßÐθ÷¸ö¶¥µãµÄ×ø±ê£¬ÈçºÎ¶ÔÏÖÓеÄͼƬ°´ÕÕÕâ¸ö¶à±ßÐνøÐÐÇиîÄØ£¿
²»Ò»¶¨ÒªÓÃPIL¿â£¬ÈκÎÄÜʵÏÖÕâ¸ö¹¦Äܵķ½·¨¶¼ÐС£
ͼƬÇиîµÄjs²»ÊǺܶàÂð£¿
......