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

python listÖÐÌí¼ÓÀà¶ÔÏóµÄÎÊÌâ

ÔÚlistÖÐÌí¼ÓÒ»¸öÀàµÄ¾Ö²¿±äÁ¿ ÕâÑù×öÊÇ·ñºÏ·¨ Çë¿´ÏÂÃæÀý×Ó:
Python code:

class A():
def __init__( self ):
self.__a = 0
self.__b = 'hello'

def get_a( self ):
return self.__a

def get_b( self ):
return self.__b

def set_a( self, m ):
self.__a = m

def set_b( self, n ):
self.__b = n

class B():
def __init__( self ):
self.__lista = []

def fun( self ):
a = A()
print id(a)
a.set_a(10)
a.set_b("word")
self.__lista.append( a ) #½«Õâ¸öÌí¼Óµ½Ò»¸öÎÒµÄÁбíÖÐ ÊÇ·ñÕýÈ·ÄØ
a.set_a(5)
return self.__lista

if __name__ == "__main__":
b = B()
m = b.fun()
print m[0].get_a()



°´Àï˵ ÎÒ¾õµÃ"a "¼ÈÈ»ÊÇÀàBµÄ¾Ö²¿ÊµÀý»¯¶ÔÏó,ÄÇôÎÒÌí¼Óµ½listaÖеÄÓ¦¸ÃÊǸö¾Ö²¿ÊµÀý»¯¶ÔÏó,º¯Êýfun½áÊøºóÓ¦¸Ã±»×Ô¶¯Ïú»ÙÁË.¿ÉÊÇÎÒÔÚmainÖÐÒÀÈ»Äܹ»»ñµÃËüµÄÖµ. ÄѵÀÕâÑù×öÊÂÕýÈ·µÄô?Ϊʲô Çë¸÷λָ½Ì
Èç¹û²»¶Ô ÄǸÃÔõô¸ÄÄØ ¶àл
ÕýÈ·

ÕâÑùΪʲôÕýÈ·ÄØ ¾Ö²¿±äÁ¿ÎÒ¾õµÃº¯Êý½áÊøµÄʱºò²»ÊÇÓ¦¸ÃÏú»ÙÁËô..

ËüÊÇÓÐÒýÓüÆÊýµÄ£¬°ÑÖµ¸³¸øÁËm£¬ÄÇô¾ÍÔö¼ÓÁËÒ»´ÎÒýÓüÆÊý£¬ËùÒԵõÈÄã²»ÓÃmÖ®ºó²Å»áÏú»Ù¡£

Â¥ÉÏÕý½â ºÃ¶à½âÊÍÓïÑÔÊÇÕâÑùµÄ

ÉùÃ÷ÀàAºÍBµÄʱºò¿ÉÒÔ²»ÒªºóÃæµÄÀ¨ºÅ

ÒýÓÃ
ÉùÃ÷ÀàAºÍBµÄʱºò¿ÉÒÔ²»ÒªºóÃæµÄÀ¨ºÅ
<


Ïà¹ØÎÊ´ð£º

pythonÖÐÏß³ÌÎÊÌ⣿£¿

ÎÒÏÖÔÚÊÇÕâÑùµÄ
¿ªÁËÒ»¸ö×ÓỊ̈߳¬¶ÁÈ¡ÏÂÃæµÄÏûÏ¢
±¾ÒâÊÇ
Python code:

while not self._stopevent.isSet( ):
re=¶ÁȡϲãÏûÏ¢
if re>0:
´¦Àí
else:
pass

¼ÙÈ ......

³õѧPYTHON£¬´ó¼ÒÖ÷ÒªÓÃËüÀ´×öʲô

    ¸Õ½Ó´¥£¬¸Ð¾õ¹¦ÄܱȽÏÇ¿´ó£¬Ö÷ÒªÊÇÕ³ºÏÐԺ㬿ÉÒÔÓлú½áºÏÆäËûÓïÑÔ¡£µ«²»Ã÷°×ËüÖ÷ÒªÓ¦ÓÃÓÚʲôÁìÓò£¬Ö÷Òª×öÄÇ·½ÃæµÄ¶«¶«¡£¿ª·¢ERPϵͳÊÇ·ñ¿ÉÐУ¿
»ù±¾ÉÏʲô¶¼¿ÉÒÔ×ö

½ñÌìÈ¥¿´ÁËһϣ¬»ù±¾ÉÏʲô ......

python PILÄ£¿é´ò¿ªÍ¼Æ¬ÎÊÌâ

ÇëÎÊÏ£¬ÎÒµÄÊÇpython2.5°²×°ÁËPILÄ£¿é£¬È»ºó±àд³ÌÐò´ò¿ª±¾»úÉϵÄÒ»¸öͼƬʱ£¬ÎªÊ²Ã´ÀϳöÏÖ´íÎóÄØ£¬ÀÏÊÇÕÒ²»µ½Í¼Æ¬£¬´íÎóÌáʾÈçÏ£ºFile "C:\Python25\Lib\site-packages\PIL\Image.py", line 1888, in o ......

pythonÔõôprint 'hello world'

´ó¼ÒºÃ£¬ÎÒÊÇÒ»¸öÐÂÊÖ£¬¸Õ¿ªÊ¼Ñ§python£¬µ«ÊǸտªÊ¼µÄhelloworld¶¼Ã»·¨´òÓ¡£¬ÈÃÎÒºÜÎÞÄΡ£
ÎÒµÄpython°²×°Â·¾¶Îªf:\python31¡£ÔÚpathÖÐÒ²ÉèÖöÔÁË£¬ÔÚwindowsÏÂÔËÐÐÊÇÕâÑùÏÔʾµÄ£¬Ï£Íû¸÷λǰ±²Ö¸µãһϡ£Ð»Ð»
Pyth ......

python dict µÄÄÚ´æ¿ØÖÆ

ϱßÊÇÎÒдµÄÒ»¶Î´úÂ룬Ëæ»úÉú³É100ÍòÌõ4ÁÐÊý¾Ý£¬²¢·Åµ½dictÀï±ß£¬È»ºó°ÑÄÚÈÝдµ½txtÎļþÖÐ

Python code:

#!/usr/bin/python2.5
import random
import time
time.sleep(5)
shapes = {}
print " ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ