title: Python: loop over a list of string and using split()
body: <p>I'm trying to split the elements of a list:</p>
  
  <pre><code>text = ['James Fennimore Cooper\n', 'Peter, Paul, and Mary\n',
          'James Gosling\n']
  
  newlist = ['James', 'Fennimore', 'Cooper\n', 'Peter', 'Paul,', 'and', 'Mary\n',
          'James', 'Gosling\n']
  </code></pre>
  
  <p>My code so far is:   </p>
  
  <pre><code>newlist = []
  
  for item in text:
      newlist.extend(item.split())
  
  return newlist
  </code></pre>
  
  <p>And I get the error:</p>
  
  <p><code>builtins.AttributeError: 'list' object has no attribute 'split'</code></p>