[Baypiggies] A properties and obj.__dict__ question
Monte Davidoff
davidoff56 at alluvialsw.com
Fri Sep 9 06:43:05 CEST 2011
On 9/8/11 9:01 PM, Dirk Bergstrom wrote:
> I think that String.format will solve this for you, based on this
> example from the python docs:
>
> >>> class Point(object):
> ... def __init__(self, x, y):
> ... self.x, self.y = x, y
> ... def __str__(self):
> ... return 'Point({self.x}, {self.y})'.format(self=self)
Yes, for Glen's example, this works:
message = """
Name: {0.name}
Address: {0.address}
""".format(f)
Monte
More information about the Baypiggies
mailing list