how to add object from dict
Steven D'Aprano
steve at pearwood.info
Thu Oct 17 05:02:41 EDT 2013
On Thu, 17 Oct 2013 11:46:52 +1100, Chris Angelico wrote:
> On Thu, Oct 17, 2013 at 11:43 AM, MRAB <python at mrabarnett.plus.com>
> wrote:
>> I'm guessing, but perhaps you need:
>>
>> instance = getattr(self, "%s" % key)
>
> How's that different from getattr(self,str(key))?
Are you blind man? The first one has a % symbol and the second one has
two extra brackets.
*wink*
--
Steven
More information about the Python-list
mailing list