© 1999-2048 dssz.net 粤ICP备11031372号
[其它] 对python中两种列表元素去重函数性能的比较方法
说明:测试函数: 第一种:list的set函数 第二种:{}.fromkeys().keys() 测试代码: #!/usr/bin/python #-*- coding:utf-8 -*- import time import random l1 = [] leng = 10L for i in range(0,leng): temp = random.randint(1,10) l1.append(temp) print '测试列表长度为:',leng #first set last = ti<weixin_38678406> 在 上传 | 大小:80896