2014-03-08 20:22:10 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import shelve
|
|
|
|
|
|
|
|
def read(afile):
|
|
|
|
d=shelve.open(afile,writeback=True)
|
|
|
|
for k in d.keys():
|
|
|
|
globals()[k]=d[k]
|
|
|
|
d.close()
|
|
|
|
|
|
|
|
def load(d):
|
|
|
|
for k in d.keys():
|
|
|
|
if k[0]!="_":
|
|
|
|
globals()[k]=d[k]
|
|
|
|
|
|
|
|
def reference(var,noms):
|
2014-03-08 22:09:07 +01:00
|
|
|
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
|
2014-03-08 20:22:10 +01:00
|
|
|
|
|
|
|
read("/home/horde/.wirechem/dbdata")
|
2014-03-08 22:09:07 +01:00
|
|
|
reference(Uworlds,['world','level'])
|
2014-03-08 20:22:10 +01:00
|
|
|
print Uworlds
|
|
|
|
print finished
|
|
|
|
print len(Uworlds[0])
|
2014-03-08 22:09:07 +01:00
|
|
|
|
2014-03-08 20:22:10 +01:00
|
|
|
|
|
|
|
|