fork download
  1. from itertools import chain
  2. mapa = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]
  3. dicionario_mapa = {posicao+1:valor for posicao, valor in enumerate(chain(*mapa))}
  4.  
  5. print(dicionario_mapa)
Success #stdin #stdout 0.04s 9336KB
stdin
Standard input is empty
stdout
{1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16}