title: How to pass a string into a function in Python
body: <p>Being new to Python, but still unescapable, I'm stuck on this problem. What I'm trying to do is pass a string into the function to get it <code>extend</code>ed.</p>
  
  <p><strong>Here is what I have:</strong></p>
  
  <pre><code>def replace(source, destination):
      local_source = src_tree.find("source")
      local_destination = dest_tree.find("destination")
      local_destination.extend(local_source)
  
  replace(source=".//animal-list/dog", destination=".//animal-list/dog")
  </code></pre>
  
  <p>This piece of code will work if I don't place it in a function. But because I have hundreds of these "<code>expend</code>" that I have to achieve, why not the good o' function calling.</p>
  
  <p><strong>Originally I have this, and it works as what I need:</strong></p>
  
  <pre><code>src = src_tree.find('.//animal-list/dog')
  dest = dest_tree.find('.//animal-list/dog')
  dest.extend(src)
  </code></pre>
  
  <p>And what that would do is "replace" the <code>dest</code> dog with <code>src</code> dog. Works perfect, but I'm trying to make it into a function for easier use.</p>
  
  <p>My question would be, what am I doing wrong in the function? Since it is tossing up a exception. </p>
  
  <pre><code>Traceback (most recent call last):
    File "test.py", line 28, in &lt;module&gt;
      replace(source=".//animal-list/dog", destination=".//animal-list/dog")
    File "test.py", line 13, in replace
      local_destination.extend(local_source)
  AttributeError: 'NoneType' object has no attribute 'extend'
  </code></pre>