title: replace multiple occurrences of any special character by one in python
body: <p>I have a string like:</p>
  
  <pre><code>string = "happy.....!!!"
  </code></pre>
  
  <p>And I want output like:</p>
  
  <pre><code>new_string = "happy.!"
  </code></pre>
  
  <p>I  know how to replace multiple occurrence of any special character. It can be done as follows:</p>
  
  <pre><code>line = re.sub('\.+', '.', line)
  </code></pre>
  
  <p>But I want to replace it for all special characters like ",./\, etc. 
  One way is to write it for each special character.
  But want to know if there is an easy way to write it for all special characters in one line.</p>