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

python²ÂÊý×ÖÓÎÏ·

from random import randint              #µ¼ÈëËæ¼´º¯Êý
def guessNum():                           #¶¨ÒåÒ»¸ö²ÂÊý×ÖÓÎÏ·º¯Êý£¬º¯ÊýÃûΪguessNum()
    guess=int(raw_input('a number for guess pls>'))   #Óû§ÊäÈëÈÎÒâÒ»¸öÊý×Ö
    key=randint(1,1000)          #»ñµÃÒ»¸öËæ»úÊý£¨¼´Óû§½«Òª²ÂµÄÄǸöÊý£©
    #print key
    for x in range(9):
         #Èç¹û²Â¶ÔÁ˵Ļ°£¬Êä³öu win²¢ÌáʾÓû§ÊÇ·ñ¼ÌÐøÓÎÏ·£¬Èç¹û¼ÌÐøÊäÈëY£¬·ñÔòÊäÈëN½áÊøÓÎÏ·
        if key==guess:                   
            print 'u win'
            is_continue = raw_input("Do you want to keep on the game?If Yes,input Y,else input N:")                  #Óû§ÊäY»òN
            if(is_continue == 'Y'):   #µ±Óû§ÊäÈëYʱ£¬µ÷ÓÃguessNum()º¯Êý£¬¼ÌÐø²ÂÊý×ÖÓÎÏ·
                guessNum()
            else:             #·ñÔòÊä³öyou had over the guessNum GameÌáʾÓû§ÒѾ­½áÊø¸ÃÓÎÏ·
                print 'you had over the guessNum Game'
           &


Ïà¹ØÎĵµ£º

PythonÍêÈ«ÐÂÊֽ̳Ì

×÷Õߣºtaowen, billrice
http://www.cnblogs.com/taowen/articles/11239.html
Lesson 1 ×¼±¸ºÃѧϰPythonµÄ»·¾³
ÏÂÔصĵØÖ·ÊÇ£º
www.python.org
ΪÁË´ó¼ÒµÄ·½±ã£¬ÎÒÔÚУÄÚ×÷ÁËcopy£º
http://10.1.204.2/tool/compiler&IDE/Python-2.3.2-1.exe
linux°æ±¾µÄÎҾͲ»ËµÁË£¬ÒòΪÈç¹ûÄãÄܹ»Ê¹ÓÃlinux²¢°²×°ºÃ˵Ã÷Äã¿ÉÒÔ ......

Python, Ruby Óë Groovy£¬Ë­ÓëÕù·æ£¿

 SleekEngine
Ëæ׿ÆËã»úÓ²¼þµÄ¿ìËÙ·¢Õ¹£¬10ÄêÇ°ÒòΪËÙ¶ÈÎÊÌâ¶ø±»Ú¸²¡µÄJavaÏÖÔÚ³ÉÁ˼ÆËã»úÁ÷ÑÔÓïÑÔÖеÄÀϴ󣬵«ÊÇËüÈ´ÈÔ±»ÈÏΪ¸´ÔÓ±¿ÖØ£¬½ü¼¸ÄêÀ´¶¯Ì¬Óï
ÑÔÈ´ÓкóÀ´¸ÏÉϵÄÇ÷ÊÆ£¬ÕÆÎÕÒ»ÃŶ¯Ì¬ÓïÑÔ³ÉÁ˳ÌÐòÔ±ÐèÒª¿¼ÂǵÄÊÂÒË¡£ ½üÆÚ½Ó´¥Á˼¸ÖÖÁ÷ÐеĶ¯Ì¬ÓïÑÔPython, Ruby,
Groovy£¬ËüÃÇÏà±È¾²Ì¬ÓïÑÔJava/C++À´Ëµ£¬´óÎ ......

²ËÄñѧPython£¨Ò»£©

   Ϊ³äʵ×Ô¼ºÄÇƽӹµÄ֪ʶ¿â£¬´Ó½ñÌ쿪ʼ£¬Ñ§Ï°PythonÓïÑÔ¡£   Ì«¸ßÉîµÄ×ÊÁÏ¿´²»¶®£¬µ±Á˱¾×î¼òµ¥µÄPython¼òÃ÷½Ì³Ì£¬ÖÐÎÄ°æchm¸ñʽµÄ¡£²»Ëµ·Ï»°ÁË£¬¿ªÊ¼½øÈëPythonµÄÊÀ½ç°É¡£ £¨Ò»£©°²×°Python    дÕâƪÎÄÕÂʱ£¬PythonµÄ×îа汾ÊÇ3.1£¬ÎÒϲ»¶ÓÃ×îеģ¬¾ÍÏÂÁËа汾µÄ¡£Ò»Â·NextÏÂÈ¥£¬ÎÒµÄC ......

Python ×Ö·û´®·½·¨Ïê½â


ÀàÐÍ
·½·¨
×¢½â
Ìî³ä
center(width[, fillchar]) ,
ljust(width[, fillchar]),
rjust(width[, fillchar]),
zfill(width),
expandtabs([tabsize])
l        
fillchar ²ÎÊýÖ¸¶¨ÁËÓÃÒÔÌî³äµÄ×Ö·û£¬Ä¬ÈÏΪ¿Õ¸ñ
l        
¹Ë ......

Python ¿½±´¶ÔÏó£¨É±´deepcopyÓëdz¿½±´copy£©

>>> import copy
>>> a = [1,2,3,4,['a','v']]
>>> b = a
>>> b
[1, 2, 3, 4, ['a', 'v']]
>>> c = copy.copy(a)
>>> c
[1, 2, 3, 4, ['a', 'v']]
>>> d = copy.deepcopy(a)
>>> d
[1, 2, 3, 4, ['a', 'v']]
>>> a.append(5) ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ