python3 for循环字典

时间:2012-11-14 01:57:16

标签: python python-3.x

  

可能重复:
  whats another way to write python3 zip

有什么更好的方式来写这些东西我被介绍给这些代码,但我不习惯以这些方式看待它们:

(alla,allc,) = (set(s) for s in zip(*animaldictionary.keys())) 
你怎么能写这个呢
print('\n'.join(['\t'.join((c,str(sum(animaldictionary.get(ac,0) 
for a in alla 
     for ac in ((a,c,),))//12)))
             for c in sorted(allc)]))

1 个答案:

答案 0 :(得分:1)

一旦我回到家并有更多时间围绕这组有趣的理解,我会用更全面(没有双关语)的结果更新我的答案。现在,您需要查看以下内容: