> > lens = [0] * len(catalog2[0]) Ah. Read the following closely: https://docs.python.org/2/faq/programming.html#how-do-i-create-a-multidimensional-list If you have any questions, please feel free to ask further. See if that clears up the mistake that's in your code.