title: Python Regex replace all newline characters directly followed by a char with char
body: <p>Example String:</p>
  
  <pre><code>str = "test sdf sfwe \n \na dssdf 
  </code></pre>
  
  <p>I want to replace the:</p>
  
  <pre><code>\na
  </code></pre>
  
  <p>with</p>
  
  <pre><code>a
  </code></pre>
  
  <p>Where 'a' could be any character.</p>
  
  <p>I tried:</p>
  
  <pre><code>str = "test \n \na"
  res = re.sub('[\n.]','a',str)
  </code></pre>
  
  <p>But how can I store the character behind the <code>\n</code> and use it as replacement?</p>