[Tutor] To FORMAT or not to

Bod Soutar bodsda at googlemail.com
Mon Jan 4 16:54:18 EST 2016


On 4 January 2016 at 19:50, Mark Lawrence
>
> Three reasons for why it's better but it doesn't actually work as given.
>
>>>> island = "Isle Of Wight"
>>>> new = "Isle of Wong"
>>>> print("You've visited {0} & {2}.".format(island, new))
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> IndexError: tuple index out of range
>
> --

Have you tried with {0} and {1}?


More information about the Tutor mailing list