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

pythonË㷨ʵ¼ù7 ¹é²¢ÅÅÐò

def MergeSort(mylist, low, mid, high):
i = low
j = mid + 1
tmp = []

while i <= mid and j <= high:
if mylist[i] <= mylist[j]:
tmp.append(mylist[i])
i = i + 1
else:
tmp.append(mylist[j])
j = j + 1

while i <= mid:
tmp.append(mylist[i])
i = i + 1
while j <= high:
tmp.append(mylist[j])
j = j + 1
for k in range(low, high):
mylist[k] = tmp[k]

mylist0 = [1, 3, 5, 7, 9, 11, 6, 8, 66, 88, 100]
MergeSort(mylist0, 0, 5, len(mylist0) - 1)
print(mylist0)


Ïà¹ØÎĵµ£º

ºÜÈ«µÄ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µÄÄÚ´æй©¼°gcÄ£¿éµÄʹÓÃ

PythonµÄÄÚ´æй©¼°gcÄ£¿éµÄʹÓÃ
                  -- 6.11ÈÕ´íÎóÐÞÕý°æ
            
Horin|ºØÇÚ
        Email: horin153@msn.com ......

Ç¿´óµÄPythonÉú³ÉÆ÷

Öð²½Ñݽø
f=open('/etc/motd','r')
longest=0
while True:
    lineLen=len(f.readline().strip())
    if not lineLen: break
    if lineLen > longest:
        longest=lineLen
f.close()
return longest
ÎÊÌâ£ºÒ»Ö±Õ¼Ó ......

Python ʹÓÃC´úÂë——swig

Ref : http://www.swig.org/translations/chinese/tutorial.html
¼ÙÉèÄãÓÐһЩcÄãÏëÔÙ¼ÓPython.¡£¾ÙÀýÀ´ËµÓÐÕâôһ¸öÎļþexample.c
 /* File : example.c */
 #include <time.h>
 double My_variable = 3.0;
 int fact(int n) {
     if (n <= 1) return 1;
&nbs ......

×Ô¶¯»¯²âÊÔÖÐPythonÓëC/C++µÄ»ìºÏʹÓÃ


±³¾°
ÏîÄ¿µÄ
×Ô¶¯»¯²âÊÔÖÐÒѾ­Ê¹ÓÃÁË»ùÓÚPython
½Å±¾µÄ¿ò¼Ü£¬×Ô¶¯»¯¹ý³ÌÖÐ×î¹Ø¼üµÄÎÊÌâ¾ÍÊÇÈçºÎʵÏÖ׮ģ¿é¡£ÔËÓÃ
Python
Ç¿´óµÄ¹¦ÄÜ£¬ÊµÏÖÈκÎ׮ģ¿é¶¼ÊÇ¿ÉÄܵģ¬µ«ÊÇÊÇ·ñ±ØÐëÍêȫʹÓÃ
Python
ʵÏÖÄ£¿éÂß¼­£¬³É±¾ÊÇÒ»¸ö¾ö¶¨ÐÔÒòËØ¡£ÔÚ׮ģ¿éÂß¼­¼òµ¥µÄÇé¿öÏ£¬Ê¹ÓÃ
Python
Ä£ÄâÄ£¿éÂß¼­²»µ«Ê¹×Ô¶¯»¯²âÊԵĽṹÇå ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ