Re: String format - resolve placeholders names

2015-11-20 Thread Ervin Hegedüs
Hi Denis, On Fri, Nov 20, 2015 at 05:08:21PM -, Denis McMahon wrote: > On Fri, 20 Nov 2015 16:53:47 +0100, Peter Otten wrote: > > > Ervin Hegedüs wrote: > > >> Python has a good string formatter, eg. I can do this: > > Or even: > > >>> s = "{who} likes {what}" > >>> d = {'who': "Adam", '

Re: String format - resolve placeholders names

2015-11-20 Thread Ervin Hegedüs
Hi Peter, On Fri, Nov 20, 2015 at 04:53:47PM +0100, Peter Otten wrote: > Ervin Hegedüs wrote: > > > Python has a good string formatter, eg. I can do this: > > > > s = "{who} likes {what}" > > d = {'who': "Adam", 'what': "ants"} > > s.format(**d) > > > > result: > > 'Adam likes ants' > > > > Is

Re: String format - resolve placeholders names

2015-11-20 Thread Denis McMahon
On Fri, 20 Nov 2015 16:53:47 +0100, Peter Otten wrote: > Ervin Hegedüs wrote: >> Python has a good string formatter, eg. I can do this: >> s = "{who} likes {what}" >> d = {'who': "Adam", 'what': "ants"} >> s.format(**d) >> result: >> 'Adam likes ants' >> Is it possible, and if yes, how to reso

Re: String format - resolve placeholders names

2015-11-20 Thread Peter Otten
Ervin Hegedüs wrote: > Python has a good string formatter, eg. I can do this: > > s = "{who} likes {what}" > d = {'who': "Adam", 'what': "ants"} > s.format(**d) > > result: > 'Adam likes ants' > > Is it possible, and if yes, how to resolve the placeholders names > in string? >>> import string

Re: String format - resolve placeholders names

2015-11-20 Thread Ervin Hegedüs
Hello Chris, On Sat, Nov 21, 2015 at 02:06:11AM +1100, Chris Angelico wrote: > On Sat, Nov 21, 2015 at 1:52 AM, Ervin Hegedüs wrote: > > Python has a good string formatter, eg. I can do this: > > > > s = "{who} likes {what}" > > d = {'who': "Adam", 'what': "ants"} > > s.format(**d) ... > > But

Re: String format - resolve placeholders names

2015-11-20 Thread Chris Angelico
On Sat, Nov 21, 2015 at 1:52 AM, Ervin Hegedüs wrote: > Python has a good string formatter, eg. I can do this: > > s = "{who} likes {what}" > d = {'who': "Adam", 'what': "ants"} > s.format(**d) > > result: > 'Adam likes ants' > > Is it possible, and if yes, how to resolve the placeholders names >