2007年03月20日 星期二 08:45
我发现当list是这样的时候下面的方法不行。List(set[[1,2],[1,2],[3,4]]))
我在添加得时候用笨办法:
try:
result.index([int(t),int(t1)]) #减去重复
except:
result.append([int(t),int(t1)])
-----邮件原件-----
发件人: python-chinese-bounces在lists.python.cn [mailto:python-chinese-bounces在lists.python.cn] 代表 limodou
发送时间: 2007年3月16日 19:03
收件人: python-chinese在lists.python.cn
主题: Re: [python-chinese] list有去重复值的函数么?
On 3/16/07, kun xu <coonxu在gmail.com> wrote:
> 搜了一下list的方法,貌似没有去重复的函数,各位去重都是怎么干的?
列表中以前有讨论
list(set([1,2,2,2,3]))
--
I like python!
UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou
_______________________________________________
python-chinese
Post: send python-chinese在lists.python.cn
Subscribe: send subscribe to python-chinese-request在lists.python.cn
Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Zeuux © 2025
京ICP备05028076号