ʹÓÃpdbµ÷ÊÔPython³ÌÐò
ʹÓÃpdbµ÷ÊÔPython³ÌÐò
±¾ÎÄÌÖÂÛÔÚûÓз½±ãµÄIDE¹¤¾ß¿ÉÓõÄÇé¿öÏ£¬Ê¹ÓÃpdbµ÷ÊÔpython³ÌÐò
Ô´ÂëÀý×Ó
ÀýÈ磬ÓÐÄ£ÄâË°ÊÕ¼ÆËãµÄ³ÌÐò£º
#!/usr/bin/python
def debug_demo(val):
if val <= 1600 :
print "level 1"
print 0
elif val <= 3500 :
print "level 2"
print (val - 1600) * 0.05
elif val <= 6500 :
print "level 3"
print (val - 3500) * 0.10 + (3500-1600) * 0.05
else:
&n
Ïà¹ØÎĵµ£º
Èç¹ûÄã¶ÔPython¾ØÕóתÖõÄʵ¼ÊÓ¦ÓòÙ×÷·½°¸µÄתÖò»ÖªµÀÈçºÎ½øÐÐÏÂÒ»²½Ê±£¬Äã¾ÍÄãÐèҪתÖÃÒ»¸ö¶þάÊý×é,½«Python¾ØÕóתÖõÄÐÐÁл¥»».
ÕâÑù¾Í¿ÉÒÔÍê³ÉÄãËùÐèÒªµÄÓ¦ÓòÙ×÷£¬ÒÔÏÂÊÇÎÄÕµľßÌå²Ù×÷¡£
ÄãÐèҪתÖÃÒ»¸ö¶þάÊý×é,½«ÐÐÁл¥»»£¬ÌÖÂÛ:ÄãÐèҪȷ±£¸ÃÊý×éµÄÐÐÁÐÊý¶¼ÊÇÏàͬµÄ.±ÈÈç:
arr
= [[1, 2,&nbs ......
̸µ½ÁËPythonÓï¾äµÄÁ½ÖÖÖ´Ðз½Ê½£¬Êµ¼ÊÉÏ£¬ÕâÁ½ÖÖÔËÐз½Ê½ÔÚ±¾ÖÊ ÉÏÊÇÏàͬµÄ£¬ËüÃǶ¼ÊÇÓɽâÊÍÆ÷À´½âÊÍÖ´ÐÐÎÒÃÇÌṩµÄPythonÓï¾ä¡£ ÕâÀïËù˵µÄ½âÊÍÖ´ÐÐÊÇÏà¶ÔÓÚ±àÒëÖ´ÐжøÑԵġ£ÎÒÃÇÖªµÀ£¬Ê¹ÓÃÖîÈç C»òC++Ö®ÀàµÄ±àÒëÐÔÓïÑÔ±àдµÄ³ÌÐò¿ÉÒÔ´ÓÔ´Îļþת»»³É¼ÆËã»úʹÓà µÄ»úÆ÷ÓïÑÔ£¬ ¾Á¬½ÓÆ÷Á¬½ÓºóÐγɶþ½øÖÆ¿ÉÖ´ÐÐÎļþ¡£µ±ÎÒÃÇÔ ......
½ñÌìÒ»ÉϿΣ¬´óÅ£ÀÏʦ¾Í¸ø´ó¼Ò³öÁËÒ»µÀÌ⣺
±à³Ì£ºÇë´Ó×Ö·û´®“goOoOogle”ÖÐÕÒ³öÒÔ“O”¿ªÍ·£¬²¢ÒÔ“O”½áÊøµÄ²¿·Ö¡£
“Õ⻹²»¼òµ¥£¬¿´ÎҵĔС²Ë²»Ò»»á¶ù¾Í¸ø³öÁ˴𰸣º
>>> s="goOoOogle"
>>> s.find("O")
2
>>> s.find("O",3)
4
>>& ......
±¾Æª½«½éÉÜ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 ......
ÏȽ«ÉÏÃæ´´½¨ºÃµÄtestdemo¹¤³ÌĿ¼\£¬½«C:\Python25\Lib\site-packages\django\binÖеÄtestdemoĿ¼¿½±´µ½×Ô¼ºµÄ¹¤×÷Ŀ¼ÖУ¬È»ºóÆô¶¯eclipse£¬µã»÷“File”->“New”->“project…”£¬½«»á¿´µ½ÒÔÏ»Ãæ
Ñ¡Ôñ“Pydev Project”£¬µã»÷“Next&rdquo ......