Alan Gauld schreef:
Timo wrote
So my entry's look like this (more or less ;)):
[person1]
firstName = foo
lastName = bar
father = person2
mother = person3
And I assume you are reading these into a Person class and
storing these classes in a persons dictionary? Then to access
a father becomes:
x = 'Person5'
print Persons[x].father.firstName
Can you explain this a little more for me please?
The current way of reading the data is this:
parser = ConfigParser.ConfigParser()
parser.read(personFile)
def get_info(person)
infoDic = {}
infoDic['first'] = parser.get(person, 'firstName')
infoDic['last'] = parser.get(person, 'lastName')
infoDic['father'] = parser.get(person, 'father')
infoDic['mother'] = parser.get(person, 'mother')
return infoDic
But maybe it can be done better.
Timo
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor