字典推导式

字典推导式

可能你见过列表推导时,却没有见过字典推导式,在2.7中才加入的:

d = {key: value for (key, value) in iterable}
posted @ 2017-12-19 15:42  雪芹  阅读(573)  评论(0编辑  收藏  举报