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

pythonѧϰ

3¡¢Lists Êý¾ÝÀàÐÍ
 
    ÔÚpythonÖУ¬listsÊÇÐòÁÐÈÝÆ÷£¬Ëü¿ÉÒÔÈÝÄÉÈκÎÀàÐ͵ĶÔÏ󡣺Ístrings²»Í¬£¬ListsÖ§³ÖÔ­µØÐÞ¸Ä(mutalbe in place),ͨ¹ýϱêÒýÓõķ½Ê½£¬¿ÉÒÔÐÞ¸ÄListsµÄÄÚÈÝ£¬ÈçpÊÇLists¶ÔÏó£¬ Ôò¿ÉÒÔͨ¹ýp[1] = '123'ÕâÖֵķ½Ê½¸Ä±äpµÄÄÚÈÝ¡£
   ListsÊÇÐòÁÐÈÝÆ÷£¬Ö§³ÖÈκÎÐòÁеIJÙ×÷£¬ÕâµãºÍStringsºÜÏñ¡£ÏÂÃæ¿´¿´¾ßÌå²Ù×÷£º
    ListsÀàËÆcÖеÄÊý×é»òÕßc++ÖеÄvector£¬µ«Ëü¸üÇ¿´ó£¬ÔÊÐíÐòÁÐÖÐÓв»Í¬µÄ¶ÔÏóÀàÐÍ£¬±ÈÈçÉÏÀýÖÐ123ÊÇÊý×ÖÀàÐÍ£¬¶ø'mikewolf'ÊÇ×Ö·û´®ÀàÐÍ¡£ÁíÍ⣬Lists»¹¿ÉÒÔËæÊ±¸Ä±äÊý×é´óС£¬ÔÚij¸öλÖÃɾ³ýÔªËØ»òÕßÔö¼ÓÔªËØ¡£
ÏÂÃæ¿´Ò»Ð©Àý×Ó£º
´ÓÉÏÃæ¿ÉÒÔ¿´µ½£¬ÒòΪListsÖ§³ÖÔ­µØ¸Ä±ä²Ù×÷£¬ËùÒÔ¾­¹ýÅÅÐò(sort)ÒÔ¼°·­×ª(reverse)²Ù×÷£¬ MµÄÄÚÈݸıäÁË¡£
ÁíÍ⣬ListsÒ²Ö§³Ö±ß½ç¼ì²é£¬±ÈÈçLÖ»ÓÐÁ½ÏÎÒÃÇÈç¹ûÕâÑù¸³Öµ L[10]=1, Python½âÊÍÆ÷»á±¨´í¡£
 Lists»¹Ö§³ÖÈÎÒâ²ã´ÎµÄǶÌ×£¬±ÈÈçÎÒÃÇ¿ÉÒÔÕâÑù¶¨Òå LʵÏÖ3*3¾ØÕó
L = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]

´ËʱL[1] ÊÇ[4, 5, 6], L[2][1] ÊÇ7¡£
ÁíÍ⣬Lists»¹Ö§³ÖÒ»Öָ߼¶²Ù×÷£¬³Æ×÷Áбí½âÊͱí´ïʽ(list comprehension expression),ÏÂÃæÍ¨¹ýÀý×ÓÀ´¿´¿´ListsÇ¿´óµÄ¸ß¼¶²Ù×÷£º
[×¢£ºdoubleÆ´³ÉÁËdoulbes]£¬¿ÉÒÔ¿´µ½¸ù¾Ý±ðµÄListsµÄÖµ£¬Í¨¹ý±í´ïʽµÄÅжϣ¬ÎÒÃÇ¿ÉÒԵõ½Ðµģ¬Âú×ãÌõ¼þµÄLists¡£ÕâÖÖ²Ù×÷ÔÚÓÐЩʱºò·Ç³£¹ÜÓá£


Ïà¹ØÎĵµ£º

Python: ʹÓÃ×°ÊÎÆ÷¡°@¡±È¡µÃº¯ÊýÖ´ÐÐʱ¼ä

¡¡¡¡PythonÖпÉÒÔʹÓÃ×°ÊÎÆ÷¶Ôº¯Êý½øÐÐ×°ÊΣ¨»ò˵°ü×°£©£¬ÀûÓÃÕâ¸öÌØÐÔ£¬¿ÉÒԺܷ½±ã¡¢¼ò½àµØ½â¾öһЩÎÊÌ⣬±ÈÈç»ñµÃº¯ÊýÖ´ÐÐʱ¼äµÄÎÊÌâ¡£
¡¡¡¡Ê×ÏÈ£¬ÎÒÃǶ¨ÒåÒ»¸öº¯Êý£¬ÈçÏ£º
¡¡¡¡def exeTime(func):
def newFunc(*args, **args2):
t0 = time.time()
print "@%s, {%s} start" % (time.strftime("%X", time.local ......

Python±Ê¼Ç£¨9£©

PythonÖеÄÎļþ²Ù×÷ÒÔ¼°ÊäÈëÊä³ö
ÎÒÃÇ¿ÉÒÔ·Ö±ðʹÓÃraw_inputºÍprintÓï¾äÀ´Íê³ÉÕâЩ¹¦ÄÜ¡£¶ÔÓÚÊä³ö£¬ÄãÒ²¿ÉÒÔʹÓöàÖÖ¶àÑùµÄstr£¨×Ö·û´®£©Àà¡£ÀýÈ磬ÄãÄܹ»Ê¹ÓÃrjust·½·¨À´µÃµ½Ò»¸ö°´Ò»¶¨¿í¶ÈÓÒ¶ÔÆëµÄ×Ö·û´®¡£ÀûÓÃhelp(str)»ñµÃ¸ü¶àÏêÇé¡£
 
 
ÁíÒ»¸ö³£ÓõÄÊäÈë/Êä³öÀàÐÍÊÇ´¦ÀíÎļþ¡£´´½¨¡¢¶ÁºÍдÎļþµÄÄÜÁ¦ÊÇ ......

Python IDE and GUI Framework for Windows

Pythonwin - Python IDE and GUI Framework for Windows.
Copyright 1994-2006 Mark Hammond
Python is Copyright (c) 2000-2008 ActiveState Software Inc.
Copyright (c) 2001-2008 Python Software Foundation.
All Rights Reserved.
Copyright (c) 2000 BeOpen.com.
All Rights Reserved.
Copyright (c) 1995-20 ......

pythonѧϰ

     ÔÚpythonÖУ¬ÈκÎÊý¾ÝÀàÐͶ¼ÊÇ“¶ÔÏ󔣬°üÀ¨pythonÌṩµÄÄÚÖöÔÏó£¬Ò²°üÀ¨Óû§Í¨¹ýpythonÓïÑÔ»òÕßCÀ©Õ¹¿â´´½¨µÄ¶ÔÏó¡£
     pythonµÄ¶ÔÏóÊǶ¯Ì¬ÀàÐÍ£¬¶øÇÒÊÇÇ¿ÀàÐÍ£¬ÕâÒâζ×ÅÖ»ÓÐÀàÐÍÆ¥ÅäµÄʱºò²ÅÄܽøÐÐÏàÓ¦µÄ²Ù×÷¡£ÏÖÔÚ£¬ÎÒÃÇÀ´Ñ§Ï°pythonµÄÄÚÖöÔÏó£¬pythonµÄÄ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ