what does int means for python ?

Irmen de Jong irmen.NOSPAM at xs4all.nl
Sun May 11 05:40:45 EDT 2008


alefajnie wrote:
> #!/usr/bin/env python
> 
> arr = [[0 for c in range(0, 10)] for r in range(0, 10)]             #
> 10x10 array
> 
> arr[2,3]                 # throws TypeError: list indices must be
> integers
> arr[int(2), int(3)]     # also throws TypeError: list indices must be
> integers !
> 
> -------------------------------------------------
> what is wrong in above script ?
> 
> 

try arr[2][3] instead.

basically your version is trying to index an array with a tuple argument (2,3).

--irmen



More information about the Python-list mailing list