ʹÓÃ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+tkдÁËÒ»¸ö¼òµ¥½Å±¾£¬ÓÃÀ´ÏÔʾһЩͼƬºÍÆä˵Ã÷£¬Éè¼Æ2¸ö°´Å¥À´·Ò³¡£¿Ø¼þ²ÉÓÃpack()·½Ê½£¬Ö÷´°¿ÚûÓÐÌرðÖ¸¶¨³ß´ç£¬°´Ï·ҳ°´Å¥ºóÄÜ×Ô¶¯ÒÀ¾ÝÄÚÈÝ×Ô¶¯Ëõ·Å´óС£¬ÈçÔ¤ÆÚÉèÏë¡£²»¹ý±È½ÏÆæ¹ÖµÄÊÇ,Èç¹ûÓÃÊ ......
ÒÑÖªPython ÖУº
s = unicode("²âÊÔ", "gb2312")
s = u'\u6d4b\u8bd5'
print s
²âÊÔ
ÔÚDelphiÀïÃæÈçºÎ½«\u6d4b\u8bd5ÕâÑùµÄ»¹Ô³ÉGb2312µÄºº×ÖÄØ£¿
ÕÒµ½¸ö·½·¨
......
ÇëÎÊÏ£¬ÎÒµÄÊÇpython2.5°²×°ÁËPILÄ£¿é£¬È»ºó±àд³ÌÐò´ò¿ª±¾»úÉϵÄÒ»¸öͼƬʱ£¬ÎªÊ²Ã´ÀϳöÏÖ´íÎóÄØ£¬ÀÏÊÇÕÒ²»µ½Í¼Æ¬£¬´íÎóÌáʾÈçÏ£ºFile "C:\Python25\Lib\site-packages\PIL\Image.py", line 1888, in o ......
ÓźñµÄ¸å³ê£¬³ÏÕÐPython¼¼ÊõÈËÔ±²ÎÓë¸÷ÖÖ¼¼ÊõÊé¼®³ö°æ¡£
ͨ¹ý¸ÃÊé¼®£¬×÷Õß¿ÉÒԵõ½Èçϱ¨³ê£º
1¡¢·áºñµÄ¸å³ê¡£
2¡¢Êé¼®Öø×÷µÄÊðÃûȨ¡£
3¡¢¶Ô×÷ÕߺÍÊé½øÐÐÐû´«£¬Ìá¸ß×÷ÕßÔÚ¼¼ÊõȦ×ÓÀ ......