title: Remove digits from string python
body: <p>I want to remove all the digits from the string other than the digits given in the dictionary. I have written code to remove it
  but not getting the expected result. Please have a look below:</p>
  
  <pre><code>mystr=" hey I want to delete all the digits ex 600 502 700 m 8745 given in this string. And getting request from the ip address 122521587502. This string tells about deleting digits 502 600 765 from this."
  
  myDict={'600','700'} # set()
  
  # snippet to remove digits from string other than digits given in the myDict 
  </code></pre>
  
  <p>My Solution   </p>
  
  <pre><code>for w in myDict:
      for x in mystr.split():
          if (x.isdigit()):
              if(x != w):
                  mystr.replace(x," ")
  </code></pre>
  
  <p>Expected result:</p>
  
  <pre><code>mystr=" hey I want to delete all the digits ex 600 700 m  given in this string. And getting request from the  
  ip address . This string tells about deleting digits  600  from this."
  </code></pre>