I have an array that I would like to take a portion of each element of the array.
id = [000222000,000333000,000444000]
id2 = [222,333,444]
In order to be able to get id2 array I am using a for loop as follows:
id2 = [i[3:5] for i in id]
However, I get an IndexError: invalid index to a scalar variable. I don't understand why am I getting this error and how to overcome it? Also is it a same principle if I have array of strings instead of numbers?