pythonÖеÄÀàÖÐÊôÐÔÔªËؼÓself.ºÍ²»¼Óself.µÄÇø±ð
ѧϰPyQt£¬·¢ÏÖÆäÖÐÒ»¶Î½Å±¾ÊÇÕâÑùµÄ£º
class Form(QDialog):
........
amountLabel = QLabel("Amount")
self.amountLabel = QLabel()
........
pythonÖеÄÀàÖÐÊôÐÔÔªËؼÓself.ºÍ²»¼Óself.µÄÇø±ðÊÇʲô£¿ÕâÁ½¸ö±äÁ¿¶¼ÔÚÀඨÒåÖС£
Ò»ÑùµÄ,Èç¹ûÄã²»¼Ó,½âÊÍÆ÷Ò²»á°ïÄã¼ÓÉÏ.
һ¥˵µÄ²»¶Ô°É£¬ÄǸöamountLabel ºÍself.amountLabel ¶¨ÒåÁËÁ½¸ö²»Í¬µÄ±êÇ©£¬ÏÔʾµÄʱºòÒ²»áÏÔʾÁ½¸ö±êÇ©£¬ÔõôÄÜ˵һÑùµÄÄØ
¼ÓºÍ²»¼Ó¾ÓÈ»ÊÇÁ½¸ö±äÁ¿£¬Ì«ÉñÆæÁË°É£¿¸ã²»¶®°¡~
2¸ö²»Í¬¸ÅÄî°É
Python code:
>>> class T(object):
... def __init__(self):
... val = 1
... self.val = 2
... print id(val)
... print id(self.val)
...
>>> t = T()
135716664
135716652
>>> print id(t.val)
135716652
...
amountLabel = QLabel("Amount")
self.amountLabel = QLabel()
layout.addWidget( amountLabel)
layout.addWidget(self.amountLabel)
...
ÕâÀï¼ÓÁË2¸ölabel
ÏÂÃæÊÇÉîÈë Python :Dive Into Python ÖÐÎÄ°æÖеÄÒ»¶Î»°£º
Python Óë´ó¶àÊýÆäËüÓïÑÔÒ»ÑùÓоֲ¿±äÁ¿ºÍÈ«¾Ö±äÁ¿Ö®·Ö£¬µ«ÊÇËüûÓÐÃ÷ÏԵıäÁ¿ÉùÃ÷¡£±äÁ¿Í¨¹ýÊ״θ³Öµ²úÉú£¬µ±³¬³ö×÷Ó÷¶Î§Ê±×Ô¶¯ÏûÍö¡£
ÓÉÓÚPythonµÄ¾Ö²¿±äÁ¿µÄ¶¨Òå´Ó¸³ÖµµÄһ˲¼ä¶ø²úÉú£¬ËùÒÔ£¬ÔÚ²»Ê¹ÓÃself.amountLabelÒýÓñä
Ïà¹ØÎÊ´ð£º
ÇëÎÊÏ£¬ÎÒµÄÊÇpython2.5°²×°ÁËPILÄ£¿é£¬È»ºó±àд³ÌÐò´ò¿ª±¾»úÉϵÄÒ»¸öͼƬʱ£¬ÎªÊ²Ã´ÀϳöÏÖ´íÎóÄØ£¬ÀÏÊÇÕÒ²»µ½Í¼Æ¬£¬´íÎóÌáʾÈçÏ£ºFile "C:\Python25\Lib\site-packages\PIL\Image.py", line 1888, in o ......
ÄÄλǰ±²¿ÉÒÔ¸øÎÒ¸öPythonдµÄ¡¾¿ÉÔËÐеÄÔ´´úÂë¡¿£¬ÊµÏÖÒÔϹ¦ÄÜ£º
1.¶ÔÖ¸¶¨¶Ë¿ÚµÄ¼àÌý²¢½ØÈ¡¡¾Ö¸¶¨¡¿Êý¾Ý°ü
2.Äܶԡ¾×Ô¼º¶¨ÒåµÄ¡¿ÐÒé°ü½øÐнâÎö
Íò·Ö¸Ðл£¡£¡£¡
ÎÒÀ´¶¥ thy38
......
code:
remote = urllib.urlopen(remote_file)
local_file = open(local_path_name, "wb")
local_file.write(remote.read())
ÎÊÌâ:
ÓÃÕâÖÖ·½Ê½¿ÉÒԺܺõÄÏÂÔØÔ¶³ÌÎļþ, ÏÖÔÚÐèÒª¼ÓÈëÒ»¸ö½ø¶ÈÏÔʾµÄ¹¦Ä ......