title: Handling word index in text files
body: <blockquote>
    <p>wordlist A: book jesus christ son david son abraham jacob judah his brothers perez amminadab</p>
    
    <p>wordlist B: akwụkwọ jizọs kraịst nwa devid nwa ebreham jekọb juda ya ụmụnne pirez aminadab</p>
    
    <h3>file.txt A:</h3>
    
    <ol>
    <li>the book of the history of jesus christ , son of david , son of abraham :</li>
    <li>abraham became father to isaac ; isaac became father to jacob ; jacob became father to judah and his brothers ;</li>
    </ol>
    
    <h3>file.txt B:</h3>
    
    <ol>
    <li>akwụkwọ nke kọrọ akụkọ banyere jizọs kraịst , nwa devid , nwa ebreham :</li>
    <li>ebreham mụrụ aịzik ; aịzik amụọ jekọb ; jekọb amụọ juda na ụmụnne ya ndị ikom ;</li>
    </ol>
  </blockquote>
  
  <p>I have 2 above word-lists (say A &amp; B) of 2 diff. languages. Both contain word translation of each other in order. My task is to run these word-lists through 2 separate files.txt of both languages like word-list A through file.txt A and vice versa, then return a line for both txt files, each will contain the index numbers of both word-list where they were found on each line of the txt paired like: </p>
  
  <blockquote>
    <ol>
    <li>2:1 7:6 8:7 10:9 12:10 14:12 16:13 [ 2:1 = 2 index of book in txt.file A and 1-akwụkwọ in txt.file B and so on]</li>
    <li>1:1 11:6 13:8 17:10 19:12 20:13 [ 1:1 = 1 index of abraham in txt.file A and 1- ebreham in txt.file B and so on].
    see codes below:</li>
    </ol>
  </blockquote>
  
  <pre><code>import sys
  
  def wordlist(filename):
      wordlist = []
      with open(filename, 'rb') as f:
          for line in f:
              wordlist.append(line)
      return wordlist
  
  eng = []
  for lines in open('eng_try.txt', 'rb'):
      line = lines.strip()
      eng.append(line)
  igb = []
  for lines in open('igb_try.txt', 'rb'):
      line = lines.strip()
      igb.append(line)
  
  i = 0
  while i &lt; len(eng):
      eng_igb_verse_pair = eng[i] + " " + igb[i]
      line = eng_igb_verse_pair.strip().split()
      for n in range(0, len(wordlist('eng_wordlist.txt'))):
          eng_word =  wordlist('eng_wordlist.txt').pop(n)
          igb_word =  wordlist('igb_wordlist.txt').pop(n)
          if eng_word in line and igb_word in line:
              print '{0} {1}:{2}'.format(i, line.index[eng_word], line.index[igb_word])
      i += 1
  </code></pre>
  
  <p>This actually prints empty. I know my problem is in the last segment of the program. Can someone help. I am not that experienced python programmer. Apologies if I didn't construct my explanation well.  </p>