title: Python, need to input csv file into a loop
body: <p>I'm going to come across as a bit of a tard.
  Only just started to learn Python in the last couple of days.</p>
  
  <p>Here is what i have so far</p>
  
  <pre><code>import os
  import urllib2
  from csv import DictReader
  
  with open('Infodoc 2.txt','r') as infile:
      incsv = DictReader(infile)
      for row in incsv:
          print row['Publisher']
          DocIn = row['DocIn']
          DocOut = row['DocOut']
          WebAddy = row['WebAddy']
  
  def moo():
      os.rename(DocIn, DocOut)
      file(DocIn, "wb").write(urllib2.urlopen(WebAddy).read())
      hosts0 = open(DocIn,"r")
      hosts1 = open(DocOut,"r")
      lines1 = hosts0.readlines()
      for i,lines2 in enumerate(hosts1):
          if lines2 != lines1[i]:
              print "line ", i, " in hosts1 is different \n"
              print lines2
  
  moo()
  </code></pre>
  
  <p>What I am aiming for is for each line for my txt document to go through my function.
  This code works once and that's it. I want it to be able to go through and pull each line and run it and then go to the next line.
  I got a feeling i need to break out the rows into lines and repeat with some sort of loop?</p>
  
  <p>If you could sort of point me in the right direction or give me a mini breakdown that would be great.</p>