On 4/11/2014 7:13 PM, blindanagram wrote:
On 11/04/2014 22:33, blindanagram wrote:
Thanks, Mark and Terry, for your rapid responses.
An interesting thread.
It just occurred to me today, and I verified, that '+1' is also seen as
a string.
>>> '{0[-1]}'.format({'-1': 'neg int key'})
'neg int
On 11/04/2014 22:33, blindanagram wrote:
Thanks, Mark and Terry, for your rapid responses.
An interesting thread.
Brian
--
https://mail.python.org/mailman/listinfo/python-list
On 4/11/2014 5:33 PM, blindanagram wrote:
With:
l = [1,2,3]
this:
print('{0[0]:d}..{0[2]:d}'.format(l))
gives 1..3 but this:
print('{0[0]:d}..{0[-1]:d}'.format(l))
gives:
Traceback (most recent call last):
File "", line 1, in
builtins.TypeError: list indices must
On 11/04/2014 22:33, blindanagram wrote:
With:
l = [1,2,3]
this:
print('{0[0]:d}..{0[2]:d}'.format(l))
gives 1..3 but this:
print('{0[0]:d}..{0[-1]:d}'.format(l))
gives:
Traceback (most recent call last):
File "", line 1, in
builtins.TypeError: list indices must b
With:
l = [1,2,3]
this:
print('{0[0]:d}..{0[2]:d}'.format(l))
gives 1..3 but this:
print('{0[0]:d}..{0[-1]:d}'.format(l))
gives:
Traceback (most recent call last):
File "", line 1, in
builtins.TypeError: list indices must be integers, not str
which seems to me counterint