title: trying to compare file with a dictionary python 2.7
body: <p>basically i'm trying to read the file below and comparing the fruit that the person wants with the fruit in the dictionary and if the stock is above 0 then print a message saying they have been given the fruit and if stock is 0 then a message saying not fruit was given etc. </p>
  
  <p>the error im getting is: "IndexError: list index out of range" on the first line of my if statement</p>
  
  <pre><code>[
  ["James Bruce", "Bananas"],
  ["Katherine Newton", "Bananas"],
  ["Deborah Garcia", "Pears"],
  ["Marguerite Kozlowski", "Pineapples"],
  ["Kenneth Fitzgerald", "Pineapples"],
  ["Ronald Crawford", "Bananas"],
  ["Donald Haar", "Apples"],
  ["Al Whittenberg", "Bananas"],
  ["Max Bergevin", "Bananas"],
  ["Carlos Doby", "Pears"],
  ["Barry Hayes", "Pineapples"],
  ["Donald Haar", "Bananas"]
  ]
  </code></pre>
  
  <p>the dictionary: {"Apples": 14, "Bananas": 14, "Pineapples": 0, "Pears": 8}</p>
  
  <pre><code>from ast import literal_eval
  with open("C:\Users\dylan gornall\Desktop\Dylan's Uni Work\stock.json") as f:
  a = f.read()
  dic = literal_eval(a)
  print(dic["Apples"])
  
  s = open ("C:\Users\dylan gornall\Desktop\Dylan's Uni Work\queue.json", 'r')
  for line in s:
  parts = line.split(',')
  
  if parts[1] == ("pears") + dic["Pears"] &gt; 1 :
      print( parts[0] + ' has been given ' + parts[1] )
  
  elif parts[1] == ("Apples") + dic["Apples"] &gt; 1 :
      print( parts[0] + ' has been given ' + parts[1] )
  
  elif parts[1] == ("Bananas") + dic["Bananas"] &gt; 1 :
      print( parts[0] + ' has been given ' + parts[1] )
  
  elif parts[1] == ("Pineapples") + dic["Pineapples"] &gt; 1 :
      print( parts[0] + ' has been given ' + parts[1] )
  </code></pre>