Python - "Struct arrays" -


i'd have struct every line find in text file. (so yeah, want define struct, count lines, , fill structs.)

in c++, c# it's fine. i'm lost in python.

my structs like:

struct[0].name = "foo"   struct[0].place = "shop"    struct[1].name = "bar"   struct[1].place = "home"   

and on.
(sorry lame question, hope other newbies (like me) find useful.)

of course, feel free edit question (title) reflect real thing.

that's named tuples for.

http://docs.python.org/dev/library/collections.html#namedtuple-factory-function-for-tuples-with-named-fields


Comments