title: 'file' object has no attribute '__getitem__'
body: <p>I am having a problem with my code where it always has the error <code>'file' object has no attribute '__getitem__'</code>.  Here is my code:</p>
  
  <pre><code>def passHack():
      import random
      p1 = random.choice(["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"])
      p2 = random.choice(["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"])
      p3 = random.choice(["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"])
      p4 = random.choice(["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"])
      p = (p1 + p2 + p3 + p4)
      g = 0000
      a = 0
      import time
      start_time = time.time()
      print "Working..."
      while (g != p):
          a += 1
          f = open('llll.txt')
          g = f[a]
          print g
          f.close()
      if (g == p):
          print "Success!"
          print "Password:"
          print g
          print "Time:"
          print("%s seconds" % (time.time() - start_time))
  
  def loopPassHack():
      t = 0
      while (t &lt;= 9):
          passHack()
          t += 1
          print "\n"
  
  passHack()
  </code></pre>
  
  <p>I noticed that this happened when I added <code>g = f[a]</code>, but I tried adding the attribute <code>__getitem__</code> to <code>g</code>, <code>f</code>, and <code>a</code>, but it still returns the same error.  Please help, and thanks if you respond!</p>