title: Iterate through a file lines in python
body: <p>I have a file which have some names listed line by line.</p>
  
  <pre><code>gparasha-macOS:python_scripting gparasha$ cat topology_list.txt 
  First-Topology
  Third-topology
  Second-Topology
  </code></pre>
  
  <p>Now I am trying to iterate through these contents, but I am unable to do so.</p>
  
  <pre><code>file = open('topology_list.txt','r')
  print file.readlines()
  for i in file.readlines():
      print "Entered For\n"
      print i
  
  topology_list = file.readlines()
  print topology_list
  </code></pre>
  
  <p>file.readlines() prints the lines of the files as a list. 
  So I am getting this:</p>
  
  <pre><code> ['First-Topology\n', 'Third-topology\n', 'Second-Topology\n']
  </code></pre>
  
  <p>However, When i iterate through this list, I am unable to do so.</p>
  
  <p>Also, when I assign it to a variable 'topology_list' as in the penultimate line and print it. It gives me an empty list.</p>
  
  <pre><code>[]
  </code></pre>
  
  <p>So I have two questions.</p>
  
  <p>What is wrong with my approach?
  How to accomplish this?</p>