python º¯Êý
PythonÖк¯Êý²ÎÊýµÄ´«µÝÊÇͨ¹ý“¸³Öµ”À´´«µÝµÄ¡£µ«ÕâÌõ¹æÔòÖ»»Ø´ðÁ˺¯Êý²ÎÊý´«µÝµÄ“Õ½ÂÔÎÊÌ┣¬²¢Ã»Óлشð“Õ½ÊõÎÊÌ┣¬Ò²¾Í˵ûÓлشðÔõô¸³ÖµµÄÎÊÌâ¡£º¯Êý²ÎÊýµÄʹÓÿÉÒÔ·ÖΪÁ½¸ö·½Ã棬һÊǺ¯Êý²ÎÊýÈçºÎ¶¨Ò壬¶þÊǺ¯ÊýÔÚµ÷ÓÃʱµÄ²ÎÊýÈçºÎ½âÎöµÄ¡£¶øºóÕßÓÖÊÇÓÉÇ°Õß¾ö¶¨µÄ¡£º¯Êý²ÎÊýµÄ¶¨ÒåÓÐËÄÖÖÐÎʽ£º
1. F(arg1,arg2,...)
2. F(arg2=<value>,arg3=<value>...)
3. F(*arg1)
4. F(**arg1)
µÚ1 ÖÖ·½Ê½ÊÇ×î“´«Í³”µÄ·½Ê½£ºÒ»¸öº¯Êý¿ÉÒÔ¶¨Òå²»ÏÞ¸öÊý²ÎÊý£¬²ÎÊý£¨ÐÎʽ²ÎÊý£©·ÅÔÚ¸úÔÚº¯ÊýÃûºóÃæµÄСÀ¨ºÅÖУ¬¸÷¸ö²ÎÊýÖ®¼äÒÔ¶ººÅ¸ô¿ª¡£ÓÃÕâÖÖ·½Ê½¶¨ÒåµÄº¯ÊýÔÚµ÷ÓõÄʱºòÒ²±ØÐëÔÚº¯ÊýÃûºóµÄСÀ¨ºÅÖÐÌṩÏàµÈ¸öÊýµÄÖµ£¨Êµ¼Ê²ÎÊý£©£¬²»ÄܶàÒ²²»ÄÜÉÙ£¬¶øÇÒ˳Ðò»¹±ØÐëÏàͬ¡£Ò²¾ÍÊÇ˵ÐβκÍʵ²ÎµÄ¸öÊý±ØÐëÒ»Ö£¬¶øÇÒÏë¸øÐβÎ1µÄÖµ±ØÐëÊÇʵ²ÎÖеĵÚһ룬ÐβÎÓëʵ²ÎÖ®¼äÊÇÒ»Ò»¶ÔÓ¦µÄ¹Øϵ£¬¼´“ÐβÎ1=ʵ²Î1 ÐβÎ2=ʵ²Î2...”¡£ºÜÃ÷ÏÔÕâÊÇÒ»Öַdz£²»Áé»îµÄÐÎʽ¡£±ÈÈ磺"def addOn(x,y): return x + y"£¬ÕâÀﶨÒåµÄº¯ÊýaddOn£¬¿ÉÒÔÓÃaddOn(1,2)µÄÐÎʽµ÷Óã¬Òâζ×ÅÐβÎx½«È¡Öµ1,Ö÷½«È¡Öµ2¡£addOn(1,2,3)ºÍaddOn (1)¶¼ÊÇ´íÎóµÄÐÎʽ¡£
µÚ2ÖÖ·½Ê½±ÈµÚ1ÖÖ·½Ê½ºÃÒ»µã£¬ÔÚ¶¨ÒåµÄʱºòÒѾ¸ø¸÷¸öÐβζ¨ÒåÁËĬÈÏÖµ¡£Òò´Ë£¬ÔÚµ÷ÓÃÕâÖÖº¯Êýʱ£¬Èç¹ûûÓиø¶ÔÓ¦µÄÐÎʽ²ÎÊý´«µÝʵ²Î£¬ÄÇôÕâ¸öÐβξͽ«Ê¹ÓÃĬÈÏÖµ¡£±ÈÈ磺“def addOn(x=3,y=5): return x + y”£¬ÄÇôaddOn(6,5)µÄµ÷ÓÃÐÎʽ±íʾÐβÎxÈ¡Öµ6£¬yÈ¡Öµ5¡£´ËÍ⣬addOn(7)Õâ¸öÐÎʽҲÊÇ¿ÉÒԵģ¬±íʾÐβÎxÈ¡Öµ7£¬yȡĬÈÏÖµ5¡£Õâʱºò»á³öÏÖÒ»¸öÎÊÌ⣬Èç¹ûÏëÈÃxȡĬÈÏÖµ£¬ÓÃʵ²Î¸øy¸³ÖµÔõô°ì£¿Ç°ÃæÁ½ÖÖµ÷ÓÃÐÎʽÃ÷ÏԾͲ»ÐÐÁË£¬Õâʱ¾ÍÒªÓõ½PythonÖк¯Êýµ÷Ó÷½·¨µÄÁíÒ»´ó¾øÕÐ ©¤©¤¹Ø½¡×Ö¸³Öµ·¨¡£¿ÉÒÔÓÃaddOn(y=6)£¬Õâʱ±íʾxȡĬÈÏÖµ3£¬¶øyÈ¡Öµ6¡£ÕâÖÖ·½Ê½Í¨¹ýÖ¸¶¨ÐÎʽ²ÎÊý¿ÉÒÔʵÏÖ¿ÉÒÔ¶ÔÐÎʽ²ÎÊý½øÐГ¾«È·¹¥»÷”£¬Ò»¸ö¸±´øµÄ¹¦ÄÜÊÇ¿ÉÒÔ²»±Ø×ñÊØÐÎʽ²ÎÊýµÄÇ°ºó˳Ðò£¬±ÈÈ磺addOn(y=4,x=6)£¬ÕâÒ²ÊÇ¿ÉÒԵġ£ÕâÖÖͨ¹ýÐÎʽ²ÎÊý½øÐж¨µã¸³ÖµµÄ·½Ê½¶ÔÓÚÓõÚ1ÖÖ·½Ê½¶¨ÒåµÄº¯ÊýÒ²ÊÇÊÊÓõġ£
ÉÏÃæÁ½ÖÖ·½Ê½¶¨ÒåµÄÐÎʽ²ÎÊýµÄ¸öÊý¶¼Êǹ̶¨µÄ£¬±ÈÈ綨Ò庯ÊýµÄʱºòÈç¹û¶¨ÒåÁË5¸öÐβΣ¬ÄÇôÔÚµ÷ÓõÄʱºò×î¶àÒ²Ö»ÄܸøËü´«µÝ5¸öʵ²Î¡£µ«ÊÇÔÚʵ¼Ê±à³ÌÖв¢²»ÄÜ×ÜÊÇÈ·¶¨Ò»¸öº¯Êý»áÓжàÉÙ¸ö²ÎÊý¡£µÚ3
Ïà¹ØÎĵµ£º
from cmd import *
class MyShell(Cmd):
def preloop(self):
print "print this line before entering the loop"
def postloop(self):
&nb ......
¹ØÓÚ¿ò¼Ü£¬Ö®Ç°ÌýµÃ±È½Ï¶à£¬ÌرðÊÇÔÚCPyGµÄÓʼþÁбíÉÏ£¬²»¹ý»¹Ã»ÓнӴ¥¹ý¡£
ÕâÒ»ÕÂÎÒ´òËãÂÔ¶Á£¬¼ÓÉÏÕâÁ½ÌìÉíÌå²»ÊÊ£¬¶ÁµÃ¸ü¼ÓÂÔÁË¡£
ÕâÒ»ÕÂÌáµ½µÄ¼¸¸ö¿ò¼ÜÎÒÌý˵µÄÓÐTKinterºÍSWIG¡£SWIG¸ãÁËһϣ¬TKinter¿´È˼ÒÓùý£¬×Ô¼º»¹Ã»ÓÐÓùý¡£¶ÔÕâЩ¿ò¼ÜÄ°ÉúµÃºÜ¡£ÒÔºóÅöÉÏÒªÓÃÁËÔÙÈÏÕæѧѧ¡£
µ½ÏÖÔÚ£¬¶ÔPythonËãÊÇÓÐЩÁ˽âÁË¡£ ......
Python , Delphi , Loki Èý¸öµ¥´ÊÓÐȤµÄÀ´Ô´
Ðí¶à³ÌÐòÉè¼ÆÓïÑԺͿª·¢¹¤¾ßÒÔ¼°¿âµÄÃû×Ö¶¼À´Ô´ÓëÉñ»°£¬ÆÄÓÐÒâ˼£º
°¢²¨ÂÞÊÇͬʱ³öÏÖÔÚÏ£À°ºÍÂÞÂíÉñ»°ÖеİÂÁÖÅÁ˹ʮ¶þ´óÉñÖ®Ò»¡£Ëû³ýÁËÓµÓÐÌ«ÑôÉñµÄÉí·Ö£¬Í¬Ê±»¹ÓÐÔ¤ÑÔ¡¢ÒÕÊõ¡¢Ò½ÊõÖ®ÉñµÄ³ÆºÅ¡£°¢²¨ÂÞÊÇÖæ˹ºÍÀÖ¶äµÄ¶ù×Ó£¬ºÍ°¢µÙÃÛ˹ÊÇË ......
½ñÌìÓöµ½Ò»¸öÒ»¸öÎÊÌ⣬Êǽ«×Ö·û´®ÀàÐ͵Äʱ¼äת»¯ÎªUTCʱ¼ä¡£ÀýÈçtime_str = "2009/11/09 12:23:23" ת»¯ÎªUTC intÐÍ¡£
ÕÒÁËһЩ×ÊÁÏ£¬·¢ÏÖtimeÄ£¿é¾ÍÄÜÍê³ÉÕâ¸öת»»¡£
import time
time_str = "2009/11/09 12:23:23"
time_s = time.strptime(time_str,"%Y/%m/%d %H:%M:%S")
utc_f = time.mktime(time_s)
utc_i = int ......
pythonÖйúÂÛ̳ http://www.okpython.com/bbs/index.php
¿ªÔ´ÉçÇø http://sourceforge.net/
python¹ÙÍø http://www.python.org/
pythonIDE BOAhttp://boa-constructor.sourceforge.net/
pythonIDE ´óÈ«http://www.oschina.net/project/tag/120
python×é¼þhttp://py.dw ......