ʹÓÃpython½øÐе¥Ôª²âÊÔ
ÇëÎÊÔõô¶ÔÒÔÏÂÕâ¶Î´úÂë×öµ¥Ôª²âÊÔÄØ£¿£¨°üÀ¨Ê¹Ó÷¾¶¸²¸Ç¡¢Ìõ¼þ¸²¸ÇµÈ°×ºÐ²âÊÔ·½·¨£©
class Case_one:
def __init__(self):
self.__a = 100
self.__b = 200
def function_a(self):
if self.__a > 50 :
print "function_a"
self.__a = 200
else:
self.__a = 0
def function_b(self):
if self.__a == self.__b:
print "function_b"
elif self.__b < 150:
self.__a = 0
else:
self.__b = 0
def function_print(self):
print 'a is %d' %self.__a
print "b is %d" %self.__b
лл¡«¡«¡«
Èç¹û»¹ÓÐ
def function_c(self):
c = 0
c = self.__a+self.__b
print "a + b",c
Ó¦¸ÃÔõô²âÄØ
Ïà¹ØÎÊ´ð£º
×î½üÓÃpythonдһ¸ö³ÌÐò,×ÜÊÇÒì³£Í˳ö£¬µ«ÊÇȴû·¨ÓÃtry..exceptÀ´²¶×½
ÓÉÓÚû·¨·¢Í¼Æ¬£¬ËùÒÔ°ÑÏà¹ØµÄÐÅÏ¢´òÓ¡³öÀ´
Òì³£µÄÐÅÏ¢´óÖÂÈçÏ£º
python.exeÓöµ½ÎÊÌâÐèÒª¹Ø±Õ¡£ÎÒÃǶԴËÒýÆðµÄ²»±ã±íʾ±§Ç¸ ......
ÓźñµÄ¸å³ê£¬³ÏÕÐPython¼¼ÊõÈËÔ±²ÎÓë¸÷ÖÖ¼¼ÊõÊé¼®³ö°æ¡£
ͨ¹ý¸ÃÊé¼®£¬×÷Õß¿ÉÒԵõ½Èçϱ¨³ê£º
1¡¢·áºñµÄ¸å³ê¡£
2¡¢Êé¼®Öø×÷µÄÊðÃûȨ¡£
3¡¢¶Ô×÷ÕߺÍÊé½øÐÐÐû´«£¬Ìá¸ß×÷ÕßÔÚ¼¼ÊõȦ×ÓÀ ......
´ó¼ÒºÃ£¬ÎÒÊÇÒ»¸öÐÂÊÖ£¬¸Õ¿ªÊ¼Ñ§python£¬µ«ÊǸտªÊ¼µÄhelloworld¶¼Ã»·¨´òÓ¡£¬ÈÃÎÒºÜÎÞÄΡ£
ÎÒµÄpython°²×°Â·¾¶Îªf:\python31¡£ÔÚpathÖÐÒ²ÉèÖöÔÁË£¬ÔÚwindowsÏÂÔËÐÐÊÇÕâÑùÏÔʾµÄ£¬Ï£Íû¸÷λǰ±²Ö¸µãһϡ£Ð»Ð»
Pyth ......
ÎÒÏÖÔÚÓÐÒ»¸öÐèÇóÊÇÕâÑùµÄ
ÎÒÓÐ2¸öÀà
class A
{
public:
int val;
}
class B
{
public:
A a
}
ÏÖÔÚÔڽű¾ÖÐÖ»ÄÜ
b.a.val = 1
ÎÒÔÚpythonÖÐÏëʹÓÃ
b.a = 1
......