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ÒýÓñä
Ïà¹ØÎÊ´ð£º
´ó¼ÒºÃ£¬ÎÒÊÇÒ»¸öÐÂÊÖ£¬¸Õ¿ªÊ¼Ñ§python£¬µ«ÊǸտªÊ¼µÄhelloworld¶¼Ã»·¨´òÓ¡£¬ÈÃÎÒºÜÎÞÄΡ£
ÎÒµÄpython°²×°Â·¾¶Îªf:\python31¡£ÔÚpathÖÐÒ²ÉèÖöÔÁË£¬ÔÚwindowsÏÂÔËÐÐÊÇÕâÑùÏÔʾµÄ£¬Ï£Íû¸÷λǰ±²Ö¸µãһϡ£Ð»Ð»
Pyth ......
ÇëÎʸßÊÖ£¬pythonÀïµÄpopenÀàËÆjavaÀïµÄÄĸöÀà»òÕß·½·¨ÄØ£¿£¿ÁíÍâjython¿ª·¢java¸ÃÈçºÎʹÓÃjythonÄØ£¿£¿
1.¿ÉÄܺÍjavaÀïµÄRuntime.getRuntime().exec£¨"ϵͳÃüÁî"£©; Æô¶¯½ø³Ì
2.eclipseÏÂÔØjython ²å¼ ......
#! c:\python26
# Filename: backup_ver1.py
import os
import time
source=[r'C:\test', r'C:\test1']
target_dir='D:\\back\\'
target=target_dir+time.strftime('%Y%m%d%H%M%S')+'.zip'
zip_command=" ......
C++Öе÷ÓÃpythonº¯Êý£¬·¢ÏÖpythonº¯ÊýµÄÒì³£ÔÚC++ÖÐÎÞ·¨²¶»ñ¡£
µ÷Óú¯ÊýÈçÏ£¬Çë´óÏÀ½â»ó
unsigned long CPythonHelper::Execute(const std::string& mml_cmd,
u ......
code:
remote = urllib.urlopen(remote_file)
local_file = open(local_path_name, "wb")
local_file.write(remote.read())
ÎÊÌâ:
ÓÃÕâÖÖ·½Ê½¿ÉÒԺܺõÄÏÂÔØÔ¶³ÌÎļþ, ÏÖÔÚÐèÒª¼ÓÈëÒ»¸ö½ø¶ÈÏÔʾµÄ¹¦Ä ......