title: How to alter multiple text files using a python script
body: <p>I'm trying to alter multiple text files using a python scrip but I'm getting, not all, but some empty files as output. How to solve this?</p>
  
  <pre><code>def tratador_arquivo(arquivo):
  with open(arquivo, 'r+',encoding="utf8") as inputtext:
      for ponto in inputtext:
          saida="saida_"+arquivo
          with open(saida, 'w') as saidatemp:
                saidatemp.write(ponto.replace('. ','.\n'))
  
  import os
  
  pasta = os.listdir('/Users/gabri/Desktop/Textos Imóveis')
  os.chdir('/Users/gabri/Desktop/Textos Imóveis')
  
  for arquivo in pasta:
      tratador_arquivo(arquivo)
  </code></pre>