python海明距离 - 5IVI4I_I_60Y的日志 - 网易博客

时间:2014-06-11 22:02:15   收藏:0   阅读:316

python海明距离 - 5IVI4I_I_60Y的日志 - 网易博客

python海明距离  

2009-10-01 09:50:41|  分类: Python |  标签: |举报 |字号 订阅

 
 
def hammingDist(s1, s2):
    assert len(s1) == len(s2)
    return sum([ch1 != ch2 for ch1, ch2 in zip(s1, s2)])

python海明距离 - 5IVI4I_I_60Y的日志 - 网易博客,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!