比如把
[['cola', 'juice', 'coffee', 'tea'],
['cola', 'juice', 'tea', 'coffee'],
['cola', 'juice', 'coffee', 'tea']]
转换成
{('cola', 'juice', 'coffee', 'tea'): 2,
('cola', 'juice', 'tea', 'coffee'): 1}
在编译器中
for i in a:
if(b.has_key(tuple(i))==False):
b[tuple(i)]=1
else:
b[tuple(i)]+=1
是可行的
哆啦的时光机
慕桂英3389331
相关分类