python 字典get方法

  1. t1 = [
  2. ['aa'],
  3. ['ff'],
  4. ['er']
  5. ]
  6. t2 = [
  7. ['aa', 11,],
  8. ['er', 99,]
  9. ]
  10. d2 = dict(t2)
  11. res = [[k[0], d2.get(k[0], 0)] for k in t1]





posted @ 2016-04-19 16:04  iAthena  阅读(279)  评论(0编辑  收藏  举报