Newbie:python equiv of c structures
Robin Boerdijk
robin.boerdijk at nl.origin-it.com
Fri Oct 29 13:50:23 EDT 1999
tom mcdavid <tmcdavid at yahoo.com> wrote in message
news:7vb7ue$avt$0 at 199.201.191.2...
> Hi,
> I am learning Python from a background of mostly FORTRAN and some
> c. I know how use structures in c, what is the analogue in Python?
> I've got Lutz' book, but it doesn't speak to my
> old-dog-learning-new-tricks background.
> Thanks,
> Tom McDavid
I think what you are looking for is a way to group data attributes. You can
do this with classes or even dictionaries.
For example:
class person:
def __init__(self):
self.name = ""
self.address = ""
self.age = ""
me = person()
me.name = "John"
me.age = 25
print me.name, ":", me.age
etc.
Robin.
More information about the Python-list
mailing list