title: Remove all numbers from .txt file in a def function-Python 3
body: <p><strong>Input:</strong> I want to take a .txt file filed with content(see example content that will be in a .txt file below) </p>
  
  <blockquote>
    <p><code>soccerfif@yahoo.com 366-44-4444 Jezos was born Jeffrey Preston Jorgensen on January 12, 1964, also 5 and 4</code></p>
  </blockquote>
  
  <p><strong>Process:</strong> I want to run it through my Def function (replace_numbers)</p>
  
  <p><strong>Output:</strong> I want the file that was ran through the function to be appended to remove all numbers (see example below)</p>
  
  <blockquote>
    <p><code>soccerfif@yahoo.com 366-44-4444 Jezos was born Jeffrey Preston Jorgensen on January 12, 1964, also  and</code></p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>import re
  theFile=open("/home/file/wow.txt",'rt', encoding= 'latin-1').read()
  words=theFile.split()
  def replace_numbers(words):
      new_words=[]
      for word in words:
          pattern= re.compile(" \d+")
          if pattern.match(1):
              new_word= re.sub(pattern, " ", word)
              new_words.append(new_word)
      return new_words
  
  r=replace_numbers(words)
  print(r)
  </code></pre>
  
  <p>Ran I ran this code i got an error of: expected string or bytes-like object</p>
  
  <p>Any suggestions on how to use a def function to do this with a file.?</p>