title: Python data type cannot change in while loop
body: <p><code>data['text']</code> is a <code>str</code>, then I use <code>data['text'][i] = data['text'][i].split()</code> to convert it to a list, but in the second while, it is still a str. More strange is that, if I use <code>data['text'][i] = data['text'][i].split()</code> in the second while to convert it to a list again, it will <em>throw an error</em> in <code>j == 2,</code></p>
  
  <blockquote>
    <p>'list' object has no attribute 'split'</p>
  </blockquote>
  
  <p>So why the change of the type of <code>data['text'][i]</code> will be invalid in the second while?</p>
  
  <pre><code>i = 0
  while i &lt; len(data['text']):
      data['text'][i] = data['text'][i].split()
      j = 0
      i += 1
      while j &lt; len(data['text'][i]):
          if data['text'][i][j].startswith('@'):
              data['text'][i].remove(data['text'][i][j])
              j -= 1
          data['text'][i][j].strip('#')
          j += 1
  </code></pre>
  
  <p>AttributeError: 'str' object has no attribute 'remove'</p>