2005年06月07日 星期二 14:09
我怎么觉得是在被面试啊。:)
如果只有四个数,这个可能是最快的:
def collisions(numbers):
return [i for i in set(numbers) if numbers.count(i)>1]
- ahbei
(http://blog.douban.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 233 bytes
Desc: not available
Url : http://lists.exoweb.net/pipermail/python-chinese/attachments/20050607/5f6817a9/attachment.bin
Zeuux © 2025
京ICP备05028076号