Re:Why Python 3 Exists
by gluelogic on Thursday December 17, 2015 @12:02PM
(#10752624)
The thing about the latter form is that you can do something like '{0} {1} {0} {2}'.format('apple', 'banana', 'orange') which results in 'apple banana apple orange'
[ Parent
| on HN ]
Re:Why Python 3 Exists
by squeaky-clean on Thursday December 17, 2015 @12:24PM
(#10752790)
You can also use keyword arguments, which is really helpful in certain situation. Example from the docs:
'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', longitude='-115.81W')