Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¹ØÓÚ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ÖеÄUnicodeÔÚDelphiÈçºÎ»¹Ô­³ÉGb2312£¿

ÒÑÖªPython ÖУº
s = unicode("²âÊÔ", "gb2312")
s = u'\u6d4b\u8bd5'
print s
²âÊÔ

ÔÚDelphiÀïÃæÈçºÎ½«\u6d4b\u8bd5ÕâÑùµÄ»¹Ô­³ÉGb2312µÄºº×ÖÄØ£¿
ÕÒµ½¸ö·½·¨
......

IIS 7 python 2.6 cgi ÎļþÉÏ´«ÎÊÌâ

ÎÒÿ´ÎÉÏ´«µÄÎļþ¶Áµ½µÄÊý¾Ý¶¼²»ÕýÈ·¡£2M µÄͼƬ¶ÁµÃ10¶àK ¡£¡£ÄÄλ´óÏÀ¿ÉÒÔ°ï°ïÎÒ°¡¡£
#!D:\ProgrammerTools\python26\python.exe
#encoding=utf-8
import cgitb
import os
cgitb.enable()
import cgi,urllib ......

ÈçºÎ½«PythonдµÄ³ÌÐòת»»³É¿ÉÖ´ÐеÄ.exeÎļþ£¿

ÎÒÊÇÔÚwindowsƽ̨Ï£¬ÓÃpython2.6 ±àдÁË£¬Ð»Ð»´ó¼ÒÁË
ÓÐpython2exeÕâ¸ö¹¤¾ß£¬ÄãÉÏÍøËÑÒ»ÏÂ

py2exe°ü£¬ÍøÉÏÓÐϵġ£

»¹ÓÐÒ»¸öPyrex¿ÉÒÔתÒëΪ´¿C£¬ÔÙÖ±½Ó±àÒë¡£---ÎÒû×Ðϸѧϰ¹ý

ÎÒÊÇÓÃpyinstaller× ......

Ò»¸öPythonС½Å±¾ÔËÐг¬Âý

ÎÒÓÃPythonдÁËÒ»¸öС½Å±¾£¬×÷ÓÃÊÇͳ¼ÆÎÒe:\downloadĿ¼ÏÂÎļþ¶¼°üº¬ÁËÄÄЩÀ©Õ¹Ãû£¬²¢´òÓ¡³öÀ´£¬µ«ÊDz»ÖªµÀΪʲô£¬Õâ¸ö½Å±¾ËäÈ»¿ÉÒÔÕý³£µÄÔËÐУ¬µ«ÊÇÔËÐеķdz£·Ç³£Âý£¬Æ½¾ùÿһ´ÎÔËÐеÄʱ¼ä¶¼³¬¹ýÁË1·ÖÖÓ²ÅÓнá¹û ......

Python ÖÐÈçºÎдif

python

content=str.find('ok')  &&  content=str.find('not ok')

ÕâÑù±íʾ ÔÚÄÚÈÝÖÐÕÒµ½ ok  »òÕß ÕÒµ½ not ok ¶ÔÂð£¿
²¢ÁÐÌõ¼þÓà and ¶ø²»ÊÇ&& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ