Page MenuHomec4science

ParameterList.py
No OneTemporary

File Metadata

Created
Sat, Nov 23, 23:12

ParameterList.py

import string
class ParametersList(dict):
def __init__(self,ID=None):
self.ID = ID
def Info(self):
for key in self.keys():
print "%s:%s =%s"%(self.ID,key,str(self[key]))
def Write(self,f):
keys = self.keys()
keys.sort()
for key in keys:
string = "%s:%s = %s\n"%(self.ID,key,str(self[key]))
f.write(string)
def Read(self,f,ID=None):
if ID==None:
ID=self.ID
f.seek(0)
lines = f.readlines()
f.seek(0)
for line in lines:
Id,val = string.split(line,':')
if Id == ID:
val = string.strip(val)
key,val = string.split(val,'=')
key = string.strip(key)
cmd = """self["%s"] = %s"""%(key,val)
exec(cmd)

Event Timeline