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

Eclipse»ùÓÚpython¡¢Django×öWeb¿ª·¢

 ÏȽ«ÉÏÃæ´´½¨ºÃµÄtestdemo¹¤³ÌĿ¼\£¬½«C:\Python25\Lib\site-packages\django\binÖеÄtestdemoĿ¼¿½±´µ½×Ô¼ºµÄ¹¤×÷Ŀ¼ÖУ¬È»ºóÆô¶¯eclipse£¬µã»÷“File”->“New”->“project…”£¬½«»á¿´µ½ÒÔÏ»­Ãæ
 
Ñ¡Ôñ“Pydev Project”£¬µã»÷“Next”
 
´´½¨Ò»¸öÓëtestdemoµÄ¹¤³Ì£¬Â·¾¶Ö¸ÏòÄãÔ­Éú³ÉµÄ¹¤³ÌĿ¼£¬Grammar VersionÑ¡Ôñ2.5µÄ°æ±¾£¬interpreter¶ÔÓ¦µÄҲҪѡÔñpython25£¬È¡ÏûϵͳÉú³ÉSrcĿ¼£¬µã»÷“finish”Íê³É´´½¨£¬ÔÚ¹¤³ÌĿ¼ÉϵãÓÒ¼ü£¬Ñ¡Ôñ“Refresh”£¬Ä㽫»áµ½Ô­Éú³ÉµÄÎļþ¡£
 
ÏÖÔÚÎÒÃÇÀ´×öһЩ²âÊÔ£¬ÏÈÀ´½¨Á¢Ò»¸ö×Ó¼¯
 
ÔÙË¢ÐÂһϹ¤³ÌĿ¼
 
ÎÒÃǽ«helloĿ¼ÏÂÏÖÔÚûÓõÄmodels.py¡¢tests.pyÁ½¸öÎļþɾ³ýµô£¬½«ÏÂÃæ´úÂëдÈëµ½hello\views.pyÖÐ
 
 
±à¼­testdemoĿ¼ÏµÄurls.py£¬ÄÚÈÝÈçÏ 
from django.conf.urls.defaults import *
urlpatterns = patterns('',
    (r'^$', 'testdemo.hello.views.index'),   
)
±£´æÎļþ£¬ÔËÐзþÎñ£¬³É¹¦µÄ»°£¬Ð§¹ûÈçÏÂ
 
from django import http 
def index(request):
    r = http.HttpResponse('<h1>Hello,Django!</h1><ul>')  
    return r


Ïà¹ØÎĵµ£º

ʹÓÃCÓïÑÔÀ©Õ¹Python(Èý)

ÉÏһƪÖÐÎÒÃÇÒѾ­Á˽âÈçºÎÔÚPython³ÌÐòºÍCÄ£¿éÖ®¼ä½øÐÐÖµµÄÏ໥´«µÝ£¬ÏÖÔÚÎÒÃÇÀ´½øÈëʵ×÷½×¶Î£¬¿´¿´ÈçºÎ½«Ò»¸öCÓïÑÔ¿ª·¢µÄ¿ªÔ´mp3±à½âÂë¿âLAME°üװΪһ¸öPythonÏ¿ÉÒÔʹÓõÄÀ©Õ¹Ä£¿é¡£Ê×ÏÈÈ¥http://lame.sourceforge.net/download.phpÏÂÔØLAMEµÄÔ´´úÂ룬ȻºóÇл»µ½rootÓû§±àÒëÔ´´úÂ룬./configure
make
make instal ......

pythonÖÐeval, exec, execfile,ºÍcompile


eval(str [,globals [,locals ]])º¯Êý½«×Ö·û´®strµ±³ÉÓÐЧPython±í´ïʽÀ´ÇóÖµ£¬²¢·µ»Ø¼ÆËã½á¹û¡£
ͬÑùµØ, execÓï¾ä½«×Ö·û´®strµ±³ÉÓÐЧPython´úÂëÀ´Ö´ÐÐ.Ìṩ¸øexecµÄ´úÂëµÄÃû³Æ¿Õ¼äºÍexecÓï¾äµÄÃû³Æ¿Õ¼äÏàͬ.
×îºó£¬execfile(filename [,globals [,locals ]])º¯Êý¿ÉÒÔÓÃÀ´Ö´ÐÐÒ»¸öÎļþ,¿´ÏÂÃæµÄÀý×Ó:
>>> ev ......

Python¾ØÕóתÖÃÖеĶþάÊý×éµÄʵ¼Ê²Ù×÷·½°¸½éÉÜ

Èç¹ûÄã¶ÔPython¾ØÕóתÖõÄʵ¼ÊÓ¦ÓòÙ×÷·½°¸µÄתÖò»ÖªµÀÈçºÎ½øÐÐÏÂÒ»²½Ê±£¬Äã¾ÍÄãÐèҪתÖÃÒ»¸ö¶þάÊý×é,½«Python¾ØÕóתÖõÄÐÐÁл¥»».
ÕâÑù¾Í¿ÉÒÔÍê³ÉÄãËùÐèÒªµÄÓ¦ÓòÙ×÷£¬ÒÔÏÂÊÇÎÄÕµľßÌå²Ù×÷¡£
ÄãÐèҪתÖÃÒ»¸ö¶þάÊý×é,½«ÐÐÁл¥»»£¬ÌÖÂÛ:ÄãÐèҪȷ±£¸ÃÊý×éµÄÐÐÁÐÊý¶¼ÊÇÏàͬµÄ.±ÈÈç:
arr
 = [[1, 2,&nbs ......

Python½âÊÍÖ´ÐÐÔ­Àí

̸µ½ÁËPythonÓï¾äµÄÁ½ÖÖÖ´Ðз½Ê½£¬Êµ¼ÊÉÏ£¬ÕâÁ½ÖÖÔËÐз½Ê½ÔÚ±¾ÖÊ ÉÏÊÇÏàͬµÄ£¬ËüÃǶ¼ÊÇÓɽâÊÍÆ÷À´½âÊÍÖ´ÐÐÎÒÃÇÌṩµÄPythonÓï¾ä¡£ ÕâÀïËù˵µÄ½âÊÍÖ´ÐÐÊÇÏà¶ÔÓÚ±àÒëÖ´ÐжøÑԵġ£ÎÒÃÇÖªµÀ£¬Ê¹ÓÃÖîÈç C»òC++Ö®ÀàµÄ±àÒëÐÔÓïÑÔ±àдµÄ³ÌÐò¿ÉÒÔ´ÓÔ´Îļþת»»³É¼ÆËã»úʹÓà µÄ»úÆ÷ÓïÑÔ£¬ ¾­Á¬½ÓÆ÷Á¬½ÓºóÐγɶþ½øÖÆ¿ÉÖ´ÐÐÎļþ¡£µ±ÎÒÃÇÔ ......

python ÃüÁîÐвÎÊý


±¾Æª½«½éÉÜpythonÖÐsys, getoptÄ£¿é´¦ÀíÃüÁîÐвÎÊý
Èç¹ûÏë¶Ôpython½Å±¾´«²ÎÊý£¬pythonÖжÔÓ¦µÄargc, argv(cÓïÑÔµÄÃüÁîÐвÎÊý)ÊÇʲôÄØ£¿
ÐèҪģ¿é£ºsys
²ÎÊý¸öÊý£ºlen(sys.argv)
½Å±¾Ãû£º    sys.argv[0]
²ÎÊý1£º     sys.argv[1]
²ÎÊý2£º     sys.argv[2]
test.py
1
import ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ