title: Trying to add file information to a list but Jupyter won't run the code
body: <p>I am trying to add the content of a file into a list using a for loop. This is the code:</p>
  <pre><code>infile = open('Cities.txt', 'r')
  cities = []
  
  line = infile.readline()
  
  while line != '':
      cities.append(infile)
      infile.close()
  
  print(cities)
  </code></pre>
  <p>But when I try to run it, Jupyter refuses to run it and stays stuck with In[*]. As far as I know, this is not an infinite loop. What am I doing wrong?</p>