¹ØÓÚpython class£º callerRefµÄÎÊÌâ
Python code:
class A:
def __init__(self):
self.B_Handle = B_Handle
self.VA = "A_init"
print "Class A init"
def __getattr__(self, name):
print "A.__getattr__"
print "name=%s" % name
def callref(self, callref="A",):
print "A.callref = %s" % callref
return self.B_Handle.callref(self, callref)
class B:
def __init__(self):
self.VB = "B_init"
print self.VB
def callref(self, [color=#FF0000]callerRef,[/color] callref):
print "B.callref = %s" % callref
B_Handle = B()
if __name__ == "__main__":
print "eval callerRef start"
a = A()
a.callref()
ÔËÐнá¹û£º
>>> B_init
eval callerRef start
Class A init
A.callref = A
B.callref = A
¿´µ½Ò»¶ÎÕâÑùµÄ´úÂ룬 ¶ÔÆäÖеÄcallerRef²»ÊǺÜÀí½â£¬Çë¸ßÊÖÖ¸µã£¡
ÖØ·¢class B ´úÂ룺
Python code:
class B:
def __init__(self):
self.VB = "B_init"
print self.VB
def callref(self, [color=#FF0000]callerRef,[/color] callref):
print "B.callref = %s" % callref
Ïà¹ØÎÊ´ð£º
ÇëÎʸßÊÖ£¬pythonÀïµÄpopenÀàËÆjavaÀïµÄÄĸöÀà»òÕß·½·¨ÄØ£¿£¿ÁíÍâjython¿ª·¢java¸ÃÈçºÎʹÓÃjythonÄØ£¿£¿
1.¿ÉÄܺÍjavaÀïµÄRuntime.getRuntime().exec£¨"ϵͳÃüÁî"£©; Æô¶¯½ø³Ì
2.eclipseÏÂÔØjython ²å¼ ......
ÎÒÊÇÔÚwindowsƽ̨Ï£¬ÓÃpython2.6 ±àдÁË£¬Ð»Ð»´ó¼ÒÁË
ÓÐpython2exeÕâ¸ö¹¤¾ß£¬ÄãÉÏÍøËÑÒ»ÏÂ
py2exe°ü£¬ÍøÉÏÓÐϵġ£
»¹ÓÐÒ»¸öPyrex¿ÉÒÔתÒëΪ´¿C£¬ÔÙÖ±½Ó±àÒë¡£---ÎÒû×Ðϸѧϰ¹ý
ÎÒÊÇÓÃpyinstaller× ......
Python ÔõÑùÆô¶¯Ô¶³ÌµÄQTP£¬È»ºóÖ´ÐÐij¸ö·¾¶ÏµÄTEST £¿
VB¿ÉÒÔÕâÑù£º
Set qtApp = CreateObject("QuickTest.Application", "192.168.0.102")
qtApp.Launch
qtApp.Visible = T ......
import os,sys,zipfile
teststr = open('1.txt').read()
zipFile = zipfile.ZipFile('test.zip','w')
zipFile.writestr('test.txt',teststr)
zipFile.close()
É ......