Python Öеĺ¯Êýµ÷Óã¨ÀàËÆcÖеÄʹÓú¯ÊýÈë¿ÚµØÖ·£©
def login():
print 'login'
def logout():
print 'logout'
controllers = {
'in': login, ##£¨ÀàËÆcÖеģºÊ¹Óú¯ÊýÈë¿ÚµØÖ·×÷Ϊ×ÖµäµÄÖµ£©
'out':logout,
}
def dispatcher(url, controllers):
func = controllers.get(url, None) ##£¨ÀàËÆcÖеģº½«º¯ÊýÈë¿ÚÖ¸Õ븳¸øfunc£©
if func:
func() ##£¨ÀàËÆcÖеģºÕâÀïͨ¹ýº¯ÊýÈë¿ÚÖ¸Õëµ÷Óú¯Êý£©
else:
print 'Wrong url!'
dispatcher('in',controllers)
dispatcher('out',controllers)
dispatcher('23',controllers)
½á¹û £º
login
logout
Wrong url!
---------------------------------------------------------------------------------------------------------
PythonÖк¯ÊýÊǸö¶ÔÏó£¬ËùÒÔÒ²ÊÇºÍÆäËû¶ÔÏóÒ»ÑùµÄʹÓá£
def f1(): ##ÉùÃ÷ÁËÒ»¸öº¯Êý¶ÔÏó
pass
a=f1 ##°Ñº¯Êý¶ÔÏóf1¸³¸øa
print a
print f1 ##½á¹ûÏàͬ (¶¼Ö¸Ïòͬһ¸öµØÖ·)
f1() ##µ÷Óú¯Êý¶ÔÏó
a() ##µ÷Óú¯Êý¶ÔÏó
Ïà¹ØÎĵµ£º
¶þ½øÖÆÎļþÏÂÔØµØÖ·£º
SinaGetBook
Ч¹ûÈçͼ£º
´úÂ룺
#!/usr/bin/env python
#coding=utf-8
#!/usr/bin/env python
#coding=utf-8
import traceback
import sys
import wx
import re
import urllib
import wx.richtext as rt
import wx.lib.buttonpanel as bp
import Casing
import Debug
def trace_back ......
¼Ìǰƪ¡¶Import Module¡·£¨http://blog.csdn.net/xiadasong007/archive/2009/09/02/4512797.aspx£©£¬¼ÌÐø·ÖÎöǶÈ벿·Ö»ù´¡ÖªÊ¶¡£Õâ´Î²»¶à˵£¬ÓÐʲôÎÊÌâ¼ÇµÃ¶à²éÓ¢ÎÄ×ÊÁÏ£¬¹úÄÚµÄÕâ·½ÃæÖªÊ¶ÉÙ
»¹ÊÇÀ´¿´´úÂ룬дÍêÎÒ¾Í˯¾õÁË~
#include "python/python.h"
#include <iostream>
using namespace std;
int ......
µ±½ñÓÐÐí¶àÃâ·ÑµÄ RDBMS£¨Relational Database Management
System£¬¹ØÏµÊý¾Ý¿â¹ÜÀíϵͳ£©£¬ÆäÖÐһЩÊÇ¿ª·ÅÔ´ÂëÈí¼þ£¬ÁíһЩÊÇÉÌÒµ³§ÉÌÌṩµÄÃâ·Ñ²úÆ·¡£Èç¹ûÄúÕýÔÚʹÓà C/C++¡¢Java™¡¢.NET
»ò PHP
¿ª·¢Ó¦ÓóÌÐò£¬ÏëѰÕÒÒ»ÖÖ¿É¿¿µÄÊý¾Ý·þÎñÆ÷£¬Ï£ÍûËüÖ§³ÖÏȽøµÄ¼¼Êõ¡¢¾ßÓв»¶ÏÀ©´óµÄ¿ª·¢ÈËÔ±ÉçÇø²¢ÒѾ²¿ÊðÔÚÐí¶à¹Ø¼ ......
PythonÖеÄÎļþ²Ù×÷ÒÔ¼°ÊäÈëÊä³ö
ÎÒÃÇ¿ÉÒÔ·Ö±ðʹÓÃraw_inputºÍprintÓï¾äÀ´Íê³ÉÕâЩ¹¦ÄÜ¡£¶ÔÓÚÊä³ö£¬ÄãÒ²¿ÉÒÔʹÓöàÖÖ¶àÑùµÄstr£¨×Ö·û´®£©Àà¡£ÀýÈ磬ÄãÄܹ»Ê¹ÓÃrjust·½·¨À´µÃµ½Ò»¸ö°´Ò»¶¨¿í¶ÈÓÒ¶ÔÆëµÄ×Ö·û´®¡£ÀûÓÃhelp(str)»ñµÃ¸ü¶àÏêÇé¡£
ÁíÒ»¸ö³£ÓõÄÊäÈë/Êä³öÀàÐÍÊÇ´¦ÀíÎļþ¡£´´½¨¡¢¶ÁºÍдÎļþµÄÄÜÁ¦ÊÇ ......