title: 2D-Array Indexing in python
body: <p>I want to calculate how many times each word of an array is there in text file. I am getting the output if write the print statement in shell. But not when I run it as a file . I am getting this <strong>error "IndexError: list index out of range".</strong>  I am a beginner in python please help me out.</p>
  
  <pre><code>from collections import Counter
  from array import *
  import string
  cnt=Counter()
  file = open('output.txt', 'r')
  word =[ ]
  c=[ ]
  count =0
  first_word =[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
  word_count = [ ]
  new_array =['CC','CD','DT','EX','FW','IN','JJ','JJR','JJS','LS','MD','NN','NNS','NNP','NNPS','PDT',
                         'POS','PRP','PRP$','RB','RBR','RBS','RP','SYM','TO','UH','VB','VBD','VBZ','WDT','WP$','WP','WRB']
  for line in file:
        words = line.split()
        word.append(words)
  for i in range(0,30):
        for j in range(0,33):
              if(new_array[j] in word[i][0]):
                    first_word[j]+=1
              else:
                    continue
  print first_word
  </code></pre>