newbie question about self and eval
Adrian Eyre
a.eyre at optichrome.com
Tue Jan 25 06:12:32 EST 2000
> class myclass:
>
> def __init__(self,filename='c:\\test.txt'):
> self.fee = []
> self.fi = []
> self.fo = []
> self.fum = []
> f = open(filename,'r')
> rl = f.readlines()
> f.close()
> for lines in rl:
> token = string.split(lines,'\011')
> # do something more efficient than this !!!
# Okay. One way is this...
try:
bucket = self.__dict__[token[0]]
except KeyError:
bucket = self.fum
bucket.append(token[1])
--------------------------------------------
Adrian Eyre <a.eyre at optichrome.com>
http://www.optichrome.com
More information about the Python-list
mailing list