title: Append() Python wiping list
body: <p>I'm trying to create a list (it'll eventually be a new column in a new df) that contains an edited url if another column contains its. But I'm struggling to get the .append() to stop rewriting the list.</p>
  <p>Here is my current code.</p>
  <pre><code>lst = []
  
  def find_url(i):
      if i == 'mark:':
          doi_index = df[&quot;col_d&quot;].index(i)
          code_index = doi_index + 1
          doi_code = df[&quot;col_d&quot;][code_index]
          url = 'doi.org/' + doi_code
  
          lst.append(url)
      else:
          lst.append(0)
  
  for i in df[&quot;col_d&quot;]:
      find_url(i)
      
      
  print(list)
      
  </code></pre>
  <p>This displays:</p>
  <pre><code>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  </code></pre>
  <p>The values in col d are lists, I needed to work out which index stored the value 'mark' so I could find the 'url' in the index after it.</p>
  <p>Col_d looks a bit like this:</p>
  <pre><code>[abc, abc, abc, abc, abc, mark, url]
  [abc, abc, abc, abc, abc, mark, url, abc]
  [abc, abc, abc, abc, mark, url]
  [abc, abc, abc, abc, abc, mark, url, abc, abc, abc]
  [abc, abc, url]
  </code></pre>
  <p>What am I doing wrong? I'm fairly new to python, so I'm sure it is something obvious. I'd also welcome any critique on how to refactor this.</p>