Re: String formatting using dictionaries

2006-04-22 Thread Clodoaldo Pinto
Thank you guys, you are great! -- http://mail.python.org/mailman/listinfo/python-list

Re: String formatting using dictionaries

2006-04-22 Thread Fredrik Lundh
Clodoaldo Pinto wrote: > I know how to format strings using a dictionary: > > >>> d = {'list':[0, 1]} > >>> '%(list)s' % d > '[0, 1]' > > Is it possible to reference an item in the list d['list']?: > > >>> '%(list[0])s' % d > Traceback (most recent call last): > File "", line 1, in ? > KeyError:

Re: String formatting using dictionaries

2006-04-22 Thread Peter Otten
Clodoaldo Pinto wrote: > I know how to format strings using a dictionary: > d = {'list':[0, 1]} '%(list)s' % d > '[0, 1]' > > Is it possible to reference an item in the list d['list']?: > '%(list[0])s' % d > Traceback (most recent call last): > File "", line 1, in ? > KeyError:

String formatting using dictionaries

2006-04-22 Thread Clodoaldo Pinto
I know how to format strings using a dictionary: >>> d = {'list':[0, 1]} >>> '%(list)s' % d '[0, 1]' Is it possible to reference an item in the list d['list']?: >>> '%(list[0])s' % d Traceback (most recent call last): File "", line 1, in ? KeyError: 'list[0]' Regards, Clodoaldo Pinto -- htt