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

pythonʹÓÃÐĵÃ2

Ŀǰ±àÒëÆ÷£¨Êµ¼ÊÊÇ·­ÒëÆ÷£©ÏîÄ¿ÒѾ­Íê³É£¬¶ÔpythonµÄʹÓÃÓÐÁ˸üÉîµÄ¸ÐÊÜ¡£
³ýÁË֮ǰ˵µÄÒÔÍ⣬ÒÔÏÂÊDz¹³ä¼¸µã£¨ÍêÈ«ÊǸöÈË¿´·¨£©¡£
Ê×ÏÈÊÇpythonÏà¶Ô·¾¶¶ÁÈ¡ÅäÖÃÎļþºÍдÎļþÎÊÌ⣬Ïà¶Ô·¾¶ÔÚpythonÖеÄʹÓøújavaºÍC++²»Í¬¡£ËüÊÇÔÚÄǸöλÖÃÔËÐÐpy½Å±¾£¬¾Í°Ñµ±Ç°Â·¾¶×÷Ϊ¸ù·¾¶¡£È磺µ±ÔÚĿ¼AÏÂÔËÐÐÒ»¸öpy½Å±¾£¬ÄÇôĿ¼A¾ÍÊÇÒ»¸ö¸ù·¾¶ÁË£¬ÄÇôËùνµÄÏà¶ÔÊÇÒÔÕâ¸ö·¾¶×÷Ϊ²Î¿¼£»µ±ÔÚĿ¼BÏÂÔËÐÐÒ»¸öpy½Å±¾£¬ÄÇôĿ¼B¾ÍÊÇÒ»¸ö¸ú·¾¶ÁË¡£
Õâʱ¾Í»á³öÏÖÔÚÕûºÏÄ£¿éʱ£¬×îÖյįô¶¯py½Å±¾µÄĿ¼λÖÃÊDz»¿ÉÈ·¶¨ÐԵģ¬ÄÇ»á³öÏֺܶàÅäÖÃÎļþ¶ÁÈ¡²»µ½£¬¶øÐ´Îļþд´íĿ¼µÄÇé¿ö¡£¶øÇÒpythonÐéÄâ»ú±¾ÉíÀ´½²£¬¼ÓÔØpyÎļþºÍ¶ÁÈ¡ÅäÖÃÎļþ£¨»òÆäËûÎļþ£©·½Ê½²¢²»Ïàͬ¡£ËùÒÔ½â¾öµÄ·½Ê½ÈçÏ£º
ʹÓÃpythonÄÚ²¿ÊôÐÔ__file__£¬±íʾµ±Ç°py½Å±¾ËùÊôµÄ·¾¶ÊÇÒ»¸ö¾ø¶Ô·¾¶¡£
²¢ÓÃos.path.split(os.path.realpath(__file__))[0]£¬À´µÃµ½µ±Ç°Ê¹ÓõÄ·¾¶¡£
Æä´ÎÊÇpythonÖÐĿ¼ÃüÃû¡¢py½Å±¾ÃüÃûºÍpy½Å±¾ÄÚÈݵÄÃüÃû¡£È磺ÔÚĿ¼CÏ£¬ÓÐÒ»¸öC.py½Å±¾Îļþ£¬C.py½Å±¾ÄÚÈÝÖÐÓÐÒ»¸öÀàCÕâÑù¡£
ÔÚÓÐЩ³¡¾°µÄµ÷ÓÃÖУ¬»áµ¼ÖÂÃüÃû³åÍ»£¬¼õÉÙÃüÃû³öÏÖÕâÑùµÄÇé¿ö¡£
½Ó×ÅpythonʹÓÃȷʵºÜÁé»î£¬´úÂëÁ¿ÉÙ£¬ÈçpythonÐòÁл¯¼¼Êõ£¬Ò²¾ÍÁ½ÈýÐи㶨£¬¶øÃ»ÓÐÏñjavaÄÇô·±ËöµÄҪʵÏÖʲô½Ó¿ÚÕâÑùµÄÏÞÖÆ¡£
¶øÇÒPython¿ª·ÅÔ´Â룬¿ÉÒÔ¿´µ½µ×²ãºÜ¶àC/C++µÄ´úÂ룬¿ÉÒԺܿì¼ÓÉî¶ÔpythonÔ­ÀíµÄÀí½â£¨²Î¿¼¡¶PythonÔ´ÂëÆÊÎö-Éî¶È̽Ë÷¶¯Ì¬ÓïÑÔºËÐļ¼Êõ¡·£¬Ä¿Ç°±¾ÈËÒ²ÔÚÑо¿µ±ÖУ¬ÆäÖеÄC/C++µÄ֪ʶ¿É²Î¿¼Thinking in C++£©£¬µ«ÊÇÔÚʵ¼ÊµÄ¿ª·¢¹ý³ÌÖУ¬pythonÏîÄ¿µÄÎĵµ±ØÐë½øÐÐÏêϸµÄ˵Ã÷£¬²»È»´úÂëºóÆÚµÄά»¤Á¿ºÜ´ó£¬Ò²¾ÍÊÇ֮ǰËù˵µÄ±äÁ¿Ã»ÉùÃ÷ÀàÐÍ£¬ÀàÓÖ¿ÉÒÔ¶¯Ì¬´´½¨Æä³ÉÔ±±äÁ¿£¬È¨Ï޵ȡ£¶¼ÊǺóÆÚά»¤ÄѶȴóµÄÒòËØ¡£
»¹ÓоÍÊÇĿǰ´ÓÍøÉϵÄ×ÊÁÏÏÔʾ£¬python¿ÉÒÔ´ò°ü³Éexe£¬µ«ÊÇûÓп´µ½ÄÜ´ò°ü³ÉÆäËûÀàÐ͵ķ½Ê½£¬Èçdll£¨±Ï¾¹pythonÒ²ÊÇC/C++д³öÀ´µÄ£©ÕâÑù¡£¸öÈ˾õµÃ´ò°üµÄÐÎʽ»¹ÊDZȽϵ¥Ò»µÄ¡£


Ïà¹ØÎĵµ£º

ÓÃCÓïÑÔÀ©Õ¹PythonµÄ¹¦ÄÜ

µ±½ñÓÐÐí¶àÃâ·ÑµÄ RDBMS£¨Relational Database Management
System£¬¹ØÏµÊý¾Ý¿â¹ÜÀíϵͳ£©£¬ÆäÖÐһЩÊÇ¿ª·ÅÔ´ÂëÈí¼þ£¬ÁíһЩÊÇÉÌÒµ³§ÉÌÌṩµÄÃâ·Ñ²úÆ·¡£Èç¹ûÄúÕýÔÚʹÓà C/C++¡¢Java™¡¢.NET
»ò PHP
¿ª·¢Ó¦ÓóÌÐò£¬ÏëѰÕÒÒ»ÖÖ¿É¿¿µÄÊý¾Ý·þÎñÆ÷£¬Ï£ÍûËüÖ§³ÖÏȽøµÄ¼¼Êõ¡¢¾ßÓв»¶ÏÀ©´óµÄ¿ª·¢ÈËÔ±ÉçÇø²¢ÒѾ­²¿ÊðÔÚÐí¶à¹Ø¼ ......

pythonµÄwiki ÁÐ×Ó.

#coding=utf-8
from newtest.wiki.models import WiKi
from django.template import loader, Context
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response

def index(request, pagename=""):
"""ÏÔʾÕý³£Ò³Ã棬¶ÔÒ³ÃæµÄÎÄ×Ö×öÌØÊâµÄÁ´½Ó´¦Àí"""
......

PythonÄÚ½¨º¯ÊýÖ®——filter,map,reduce

     ÔÚ½²Êöfilter£¬mapºÍreduce֮ǰ£¬Ê×ÏȽéÉÜÒ»ÏÂÄäÃûº¯Êýlambda¡£
     lambdaµÄʹÓ÷½·¨ÈçÏ£ºlambda [arg1[,arg2,arg3,...,argn]] : expression
     ÀýÈ磺
     >>> add = lambda x,y : x + y
>>> add ......

Python±Ê¼Ç£¨8£©

PythonµÄÃæÏò¶ÔÏóÐÔÖÊ
ÀàºÍ¶ÔÏóÊÇÃæÏò¶ÔÏó±à³ÌµÄÁ½¸öÖ÷Òª·½Ãæ¡£Àà´´½¨Ò»¸öÐÂÀàÐÍ£¬¶ø¶ÔÏóÕâ¸öÀàµÄ ʵÀý ¡£ÕâÀàËÆÓÚÄãÓÐÒ»¸öintÀàÐ͵ıäÁ¿£¬Õâ´æ´¢ÕûÊýµÄ±äÁ¿ÊÇintÀàµÄʵÀý£¨¶ÔÏ󣩡£
 
ÐèҪעÒâµÄÊÇ£¬ÔÚPythonÖУ¬¼´±ãÊÇÕûÊýÒ²±»×÷Ϊ¶ÔÏó£¨ÊôÓÚintÀࣩ¡£ÕâºÍC++¡¢Java£¨1.5°æÖ®Ç°£©°ÑÕûÊý´¿´â×÷ΪÀàÐÍÊDz»Í¬µÄ¡£Í¨¹ ......

python֮ǿ´óµÄÈÕ־ģ¿é¡¾×ª¡¿

1.¼òµ¥µÄ½«ÈÕÖ¾´òÓ¡µ½ÆÁÄ»

import
logging

logging.
debug(
'This is debug message'
)
logging.
info(
'This is info message'
)
logging.
warning(
'This is warning message'
)
 
ÆÁÄ»ÉÏ´òÓ¡:

WARNING:root:This is warning ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ