title: AttributeError: 'list' object has no attribute 'split' in Python
body: <p>I am having problems with this bit of code</p>
  
  <pre><code>import csv
  temp = open("townsfile.csv", "r")
  towns = temp.read()
  temp.close()
  print(towns)
  
  eachTown = towns.split("\n")
  print (eachTown)
  
  record = eachTown.split(",")
  
  for line in eachTown:
      record = eachItem.split(",")
  
  print(record)
  
  newlist=[]
  
  newlist.append(record)
  
  newlist=[]
  for eachItem in eachTown:
  record = eachItem.split(",")
  newlist.append(record)
  
  print(newlist)
  </code></pre>
  
  <p>It returns this error </p>
  
  <pre><code>Traceback (most recent call last):
    File "N:/Python practice/towns.py", line 10, in &lt;module&gt;
      record = eachTown.split(",")
  AttributeError: 'list' object has no attribute 'split'
  </code></pre>
  
  <p>Can anyone help me with this </p>