title: Stripping time (in the format hh:mm) from a string in Python 2
body: <p>I have been trying to strip out all the occurrences of sequences of text that are in the format</p>
  
  <pre><code>'%d:%d'
  </code></pre>
  
  <p>(for example, 05:45) from a string. I have tried the following code:</p>
  
  <pre><code>def remove_times(s):
      for i in range(len(s)):
          if s[i] == ':':
              s = s.replace(s[i-2:i]+':'+s[i:i+3], '')
  return s
  </code></pre>
  
  <p>This is not a solution to my problem for a few reasons and it doesn't work in the form given above either.</p>
  
  <p>My problem is I don't know how to replace patterns which take the form above. It seems like there would be a neat way of doing this but I can't find it.</p>
  
  <p>For example a sample input would be:</p>
  
  <pre><code>'the time is currently: 05:52'
  </code></pre>
  
  <p>And the corresponding output would be:</p>
  
  <pre><code>'the time is currently: '
  </code></pre>
  
  <p>So the whole time gets deleted from the input and returned.</p>