Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array of structires or equivalent

Status
Not open for further replies.

dbrb2

Instructor
Jul 19, 2004
121
0
0
GB
Second basic question...

I am reading and parsing a text file. I want to be able to store the data recovered. I had thought of using an array of structures, so I could have entry[5].variable for example. However in Python this seems not to be possible...?

The nearest seems to be a dictionary of dictionaries...


Ben
 
Oh - I think I've sorted it. I can have a list of classes. Each time I append a class to the list it creates a new instance. Even though I have not given the instances individual names, since they are all in their own list elements everything works out ok...

 
A list of class instances works, but it not very nice... I could possible use nested dictionaries, but I'm not sure this is any better really.

The problem is that the list is populated in a class method. If to do this it needs to create instances of inner classes things start to get a bit messy (I think - I may be wrong)

Cheers,

Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top