易截截图软件、单文件、免安装、纯绿色、仅160KB

python算法实践1 直接插入排序

# 直接插入排序
def InsertSort(mylist):
size = len(mylist)
i = 1
for i in range(1, size):
if mylist[i] < mylist[i - 1]:
tmp = mylist[i]
j = i - 1
mylist[j + 1] = mylist[j]

j = j - 1
while j >= 0 and mylist[j] > tmp:
mylist[j + 1] = mylist[j]
j = j - 1
mylist[j + 1] = tmp
mylist0 = [12, 11, 13, 1, 2, 4, 3]
InsertSort(mylist0)
print(mylist0)
 


相关文档:

第一个python小程序

闲的无聊就看了一点关于python的基础知识,当时也不知道python和perl之间争论的这么的激烈(主要是当时不知道perl这个语言的性质),所以直接就看了python,下面是我的第一个用python写的小程序源码,希望朋友们多多指教,有什么问题大家尽管指正,在此先谢谢大家了。
[code]
#!/usr/bin/python
import sys, os, re
impor ......

很全的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 线程同步

多个执行线程经常要共享数据,如果仅仅读取共享数据还好,但是如果多个线程要修改共享数据的话就可能出现无法预料的结果。
    假如两个线程对象t1
和t2
都要对数值num=0
进行增1运算,那么t1
和t2
都各对num
修改10
次的话,那么num
最终的结果应该为20
。但是如果当t1
取得num
的值时(假如此 ......

python类型转换、数值操作


2008-12-21
python类型转换、数值操作
关键字: python类型转换、数值操作
python类型转换
Java代码
函数                      描述   
int(x [,base ])    ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号