[Tutor] Handling Objects
ewalker at micron.com
Wed Oct 5 23:41:59 CEST 2005
New to Python and trying to do some class stuff with a simple task.
1) get a list of file names in a directory
2) create variables with the same name of each filename pulled from the
3) Create an object for each and pass into the __init__ method the stringname
of the file name.
This way I get a collection of objects that are the same name as the file name
and within each instance of the class , a particular attribute will have the
string name of the object. Hope this isn't too confusing.. example.
def __init__(self,value):#createMethod auto executes since it has __
self.BASENAME = value
def display(self):#display method
temp=currentDir + '/TEMP'
for name in baseList:
name = TPROJ(name)
Can anyone see what I am trying to do?
More information about the Tutor