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

pythonË㷨ʵ¼ù3 ðÅÝÅÅÐò

#ðÅÝÅÅÐò
def BubbleSort(mylist):
n = len(mylist)
i = 0
j = 0
bExchange = False
for i in range(1, n):
bExchange = False
j = n - 1
while j >= i:
if mylist[j] < mylist[j - 1]:
tmp = mylist[j]
mylist[j] = mylist[j - 1]
mylist[j - 1] = tmp
bExchange = True
j = j - 1
if not bExchange:
break

mylist0 = [11, 10, 4, 2, 1, 55, 99, 102]
BubbleSort(mylist0)
print(mylist0)


Ïà¹ØÎĵµ£º

Python intÀàÐͲåÈëÊý¾Ý¿â MySQLdb

 def test2():
 32     db = util.DBUnit('mysql_ab')                                    &nb ......

python ÈçºÎ·µ»Ø¶à¸öÖµ

ÈçºÎдһ¸ö·µ»Ø¶à¸öÖµµÄº¯Êý
º¯ÊýµÄreturn Óï¾äÖ»ÄÜ·µ»ØÒ»¸öÖµ£¬¿ÉÒÔÊÇÈκÎÀàÐÍ¡£
Òò´Ë£¬ÎÒÃÇ¿ÉÒÔ“·µ»ØÒ»¸ö tupleÀàÐÍ£¬À´¼ä½Ó´ïµ½·µ»Ø¶à¸öÖµ
”¡£
Àý:   x ³ýÒÔ y µÄÓàÊýÓëÉ̵ĺ¯Êý
def    F1 ( x, y ):
         a = x % y
  ......

ºÜÈ«µÄPython×ÊÔ´ÊÕ¼¯

Programming Python, 2nd Edition (O'Reilly)
http://www.osbbs.com/dl/Programming Python, 2nd Edition (O'Reilly).chm
ºÜÈ«ºÜ¾­µäÁËpythonѧϰÈëÃÅ×ÊÁÏ
OReilly - Learning Python:
http://www.osbbs.com/dl/OReilly - Learning Python.chm ......

Python Ïß³Ìͬ²½¶ÓÁÐ

ÎÒÃǾ­³£»á²ÉÓÃÉú²úÕß/Ïû·ÑÕß¹ØÏµµÄÁ½¸öÏß³ÌÀ´´¦ÀíÒ»¸ö¹²Ïí»º³åÇøµÄÊý¾Ý¡£ÀýÈçÒ»¸öÉú²úÕßÏ߳̽ÓÊÜÓû§Êý¾Ý·ÅÈëÒ»¸ö¹²Ïí»º³åÇøÀµÈ´ýÒ»¸öÏû·ÑÕßÏß
³Ì¶ÔÊý¾ÝÈ¡³ö´¦Àí¡£µ«ÊÇÈç¹û»º³åÇøµÄ̫С¶øÉú²úÕߺÍÏû·ÑÕßÁ½¸öÒì²½Ï̵߳ÄËٶȲ»Í¬Ê±£¬ÈÝÒ׳öÏÖÒ»¸öÏ̵߳ȴýÁíÒ»¸öÇé¿ö¡£ÎªÁ˾¡¿ÉÄܵÄËõ¶Ì¹²Ïí×ÊÔ´²¢ÒÔÏàͬ
Ëٶȹ¤×÷µÄ¸÷Ïß³ ......

example of python operator overloadind

And last here is the overload operators example:
# map() takes two (or more) arguments, a function and a list to apply the function to
# lambda can be put anywhere a function is expected
# map() calls lambada for every element in the self list
# since Vector has overloaded __getitem__ and __len_ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ