title: Python - Googletrans for multiple txt files in loop
body: <p>I'm seeking to run googletrans to translate a series of 300 .txt files in a single folder. I'm struggling to construct a loop that will allow me to run a translation of each file and write the output in new .txt files. Googletrans has a limit on bulk translations, so I'm happy to limit the iterations to 50 files at a time.</p>
  <p>Here's the code for translating a single file. It prints the original txt file, then the translated file, and finally outputs the file into a new txt file.</p>
  <pre><code>from googletrans import Translator
  
  f = open('Translation Project\page_323.txt', 'r')
  
  if f.mode == 'r':
      contents = f.read()
      print(contents)
  
  translator = Translator()
  result = translator.translate(contents, dest='en')
  print(result.text)
  
  with open('Translation Project\trans_page_323.txt', 'w') as f:
      f.write(result.text) 
  </code></pre>
  <p>Any thoughts? New to Python and still wrapping my head around loops.</p>