Python List Comprehension, Dictionary Comprehension

[ x*x for x in range(5)]

{i: datas[i] for i in range(len(datas))}
{0:”hello”}, {1:”abc”}, …

reference: https://stackoverflow.com/questions/14507591/python-dictionary-comprehension

posted on 2024-07-20 20:27  norsd  阅读(2)  评论(0编辑  收藏  举报  来源

导航