# Lists, Arrays, and Tuples!

Discussion created by jahood on Nov 29, 2011
Latest reply on Dec 2, 2011 by mkyffin
Lists, Arrays, and Tuples!

I have a complicated script and a complicated problem. I have simplified it down to the following example:

I grab a field from a shapefile using updatecursor and input the field values into a list:

`list = ["111-11-1","222-22-2","333-33-3"]`

I need to split these lists up into integers so i can do some math on the first column of each string. (need to add 180 if < 180, and need to subtract 180 if > 180.)

```for l in list:
splitlist.append(l.split("-"))

print splitlist

for segment in splitlist:
print segment

```

Result:
```[['111', '11', '1'], ['222', '22', '2'], ['333', '33', '3']]
['111', '11', '1']
['222', '22', '2']
['333', '33', '3']
```

So I am able to isolate the values I need to perform the math on, but how do I call them to a variable and then insert them back in?

Here is a copy of my full code for this problem, with the third segment being my failed attempt at 2 d arrays.

```list = ["111-11-1","222-22-2","333-33-3"]

splitlist=[]
for l in list:
splitlist.append(l.split("-"))

print splitlist
records=0
for split in splitlist:
records=records+1
print split

columns=3
for j in range(records):
for i in range(columns):
current = splitlist[[records],[columns]]
splitarray[[records],[columns]].append(current)
print current
print splitarray[[records],[columns]]```

Error Message:
```line 25, in <module>
current = splitlist[[records],[columns]]
TypeError: list indices must be integers, not tuple```

I found an exceptional resource here but it doesn't help with this problem: http://www.astro.ufl.edu/~warner/prog/python.html