From 44600c0b0e4539eb4166081a5ce374d63f671200 Mon Sep 17 00:00:00 2001 From: Le_dahut Date: Sat, 8 Mar 2014 22:09:07 +0100 Subject: [PATCH] Correction du bug dans la fonction reference. --- read.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/read.py b/read.py index deb4759..f52e9f7 100644 --- a/read.py +++ b/read.py @@ -15,19 +15,20 @@ def load(d): globals()[k]=d[k] def reference(var,noms): - sizex=len(var) - if len(noms)==2: sizey=len(var[0]) - for x in range(sizex): - for y in range(sizey): - print var[x][y]['level'] - var[x][y][noms[0]]=x - if len(noms)==2: var[x][y][noms[1]]=y - + if len(noms)==2: + for y in range(len(var)): + for x in range(len(var[y])): + var[y][x][noms[0]]=y + var[y][x][noms[1]]=x + else: + for x in range(len(var[y])): + var[x][y][noms[0]]=x read("/home/horde/.wirechem/dbdata") +reference(Uworlds,['world','level']) print Uworlds print finished print len(Uworlds[0]) -reference(Uworlds,['world','level']) +