IndexError: tuple index out of range

Invert invert314 at gmail.com
Sat May 30 16:11:40 EDT 2009


My simple python script gives me an error when I try to execute it.  Here is
the error message:

daniel at ibex:~/Desktop/python$ python3 str_format2Daniel.py
> Traceback (most recent call last):
>   File "str_format2Daniel.py", line 8, in <module>
>     print ("{0} is {1} years old {3} and ".format(name, age, append))
> IndexError: tuple index out of range
> daniel at ibex:~/Desktop/python$
>

Here is my script:

#!/usr/bin/python
> # Filename: str_format2.py
>
> age = 23
> name = 'Daniel'
> append = '6 months'
>
> print ("{0} is {1} years old {3} and ".format(name, age, append))
> print ('{0} will be an elite python programmer in {2}.'.format(name,
> append))


What am I doing wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090530/c8e92b5b/attachment.html>


More information about the Python-list mailing list