JonathanB wrote:
> So given that example, is there a clean way to get this output:
>
> Data for Earth:
> Name = Earth
> WTN = 5.0
> Ag = 0
> Na = 0
> ...
> ...
> Notes = None
Sure, save the __init__ parameters explicitly in a dict.
self.data = {"Name": name,
"WTN": WTN,
"Ag": Ag,
...
}
To display them, you can iterate through the dict:
print "Data for Earth:"
for field, content in self.data.items():
print "%s = %r" % field, content
Hope that helps.
Regards,
Björn
--
BOFH excuse #188:
..disk or the processor is on fire.
--
http://mail.python.org/mailman/listinfo/python-list