¹ØÓÚPythonÖÐÒ»Öֻص÷·½Ê½µÄʵÏÖ
#¹ØÓڻص÷¹¦ÄܵIJâÊÔ
#FunctorÊÇÕâÖֻص÷¹¦ÄܵĹؼü¶ÔÏó
class Functor:
"""Simple functor class."""
def __init__( self, fn, *args ):
self.fn = fn
self.args = args
def __call__( self, *args ):
self.fn( *(self.args + args) )
#Ïë¶Ô¸Ãº¯Êý½øÐлص÷²Ù×÷
def test_callback1(arg1, arg2):
print "test_callback1", arg1, arg2
#ÏȽøÐмòµ¥µØ²âÊÔ
obj_call1 = Functor(test_callback1, 1111, 'qweqwe111111111')
obj_call1()
#½á¹û£º
#test_callback1 1111 qweqwe111111111
#¿´¿´¹ý³ÌÖдøÈë²ÎÊýµÄ·½Ê½
def test_callback2(arg1, arg2, call_arg):
print "test_callback2", arg1, arg2, call_arg
obj_call2 = Functor(test_callback2, 2222, 'qweqwe22222222')
obj_call2(222)#¹ý³ÌÖÐÊäÈë²ÎÊý£¬²¢ÇÒʹ»Øµ÷º¯ÊýµÃµ½Õâ¸ö²ÎÊý
#½á¹û£º
#test_callback2 2222 qweqwe22222222 222
#ÔÙÀ´¿´¿´¶ÔÏóÖеķ½·¨±»ÓÃÀ´»Øµ÷
#»ù±¾ÔÀíÓëÉÏÃæÁ½¸öÀý×ÓÏàͬ£¬µ«¿ÉÒÔÒýÈë¶ÔÏó±¾ÉíµÄº¯Êý
#²¢ÇÒÒ²¿ÉÒýÈëÆäËû¶ÔÏó½øÐлص÷£¬ÄÇôËüµÄÓ÷¨½«»á·Ç³£·á¸»
class Test:
def __init__(self):
pass
def test_callback1(self, arg1, arg2):
print "Test.test_callback 1111", arg1, arg2
def test_callback2(self, arg1, arg2, call_arg):
print "Test.test_callback 2222", arg1, arg2, call_arg
def test_callback_arg(self):
obj_call1 = Functor(self.test_callback1, 1111, 'qweqwe1111')
print "obj_call1 = ",obj_call1
 
Ïà¹ØÎĵµ£º
µ±ÒªÊ¹º¯Êý½ÓÊÕÔª×é»ò×ÖµäÐÎʽµÄ²ÎÊýµÄʱºò£¬ÓÐÒ»ÖÖÌØÊâµÄ·½·¨£¬Ëü·Ö±ðʹÓÃ*ºÍ**ǰ׺¡£ÕâÖÖ·½·¨ÔÚº¯ÊýÐèÒª»ñÈ¡¿É±äÊýÁ¿µÄ²ÎÊýµÄʱºòÌØ±ðÓÐÓá£
>>> def powersum(power, *args):
... '''Return the sum of each argument raised to specified power.'''
... ......
1.»¥ÁªÍø£ºÓÖÒôÒë“ÒòÌØÍø”»òÕß“Ó¢ÌØÍø”£¬ÊÇÖ¸ÔÚARPAÍø»ù´¡ÉÏ·¢Õ¹³öµÄÊÀ½çÉÏ×î´óµÄÈ«ÇòÐÔ»¥ÁªÍøÂç¡£
2.Óйػ¥ÁªÍøµÄÐÒé¿ÉÒÔ·ÖΪ3²ã£º
×îµ×²ãµÄÊÇIPÐÒ飬ÊÇÓÃÓÚ±¨ÎĽ»»»ÍøÂçµÄÒ»ÖÖÃæÏòÊý¾ÝµÄÐÒ飬ÕâÒ»ÐÒ鶨ÒåÁËÊý¾Ý°üÔÚÍø¼Ê´«ËÍʱµÄ¸ñʽ¡£
ÉÏÒ»²ãÊÇUDPÐÒéºÍTCPÐÒ飬ËüÃÇÓÃÓÚ¿ØÖÆÊý¾ÝÁ÷µÄ´«Ê ......
urlÅäÖÃ
ÎÒÃÇÔÚpollsÕâ¸öappÏ´´½¨Ò»¸ö
helloworld.py
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, Django.")
ÐÞ¸Ä urls.py
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
# from django.contrib ......
½âѹdjango£¬È»ºóµ½ÆäĿ¼Ï°²×°
ǰÌáÊÇÄã°²×°ºÃpython.²¢½«ÆäÅäÖõ½»·¾³±äÁ¿ÖУ¬È»ºóÈ¥djangoµÄѹËõÎÄÐÞµÄÏ£¬Ö´ÐÐÒÔϵ¹ÃüÁî
python setup.py install
1.´´½¨project
Ê×ÏÈÎÒÃÇ´ò¿ªcmd, ¶¨Î»µ½Ï£Íûн¨¹¤³ÌµÄĿ¼ÏÂ, ÈÎÒâĿ¼¾ù¿É. È»ºó¼üÈëÈçÏÂÃüÁî:
django-admin.py startproject helloÆäÖÐhelloΪй¤³ÌĿ¼ÎļþÃû ......
Help£¡·Software Upates£¡·Find and Install£¡·Search for new features to install-¡·New remote site£¡·Ëæ±ãÆð¸önameÈçpydev£¬urlÌî http://pydev.sf.net/updates/ £¡·È»ºóÕÕ×ÅÌáʾÏÂÔØ°²×°¼´¿É¡£
PydevµÄÅäÖÃ
ÔÚEclipse IDE Ï£¬ ´ò¿ª Window->Preferences... ¶Ô»°¿ò£¬´ÓÓÒ²àµÄÊ÷ÐÎÁбíÖÐÑ¡Ôñ“ PyDev&r ......