标签:alt dup print split pytho str 技术分享 logs height
l = [1,2,3,2,1]
# l = [‘你‘,‘我‘,‘他‘,‘她‘,‘你‘]
for i in l:
print("the %s has found %s" % (i, l.count(i))) #find duplicate number
# print("the %s has found %s" % (i, l.count(i))) #find duplicate string
#the method above would repeat count duplicate data ,so we need to remove duplicate first
print ‘split line ----------------------------‘
s = set(l)
for j in s:
print("the %s has found %s" % (j, l.count(j))) #find duplicate number
标签:alt dup print split pytho str 技术分享 logs height
原文地址:http://www.cnblogs.com/vickey-wu/p/6579653.html