title: How can I extract the max value out of multiple text files within a directory
body: <pre><code>import numpy as np
  from itertools import product
  import os
  import glob
  
  dirname=&quot;x&quot;
  ext=('y.dat')
  for files in os.listdir(dirname):
      if files.endswith(ext):
          temp=np.loadtxt(files)
          print(np.max(temp))
      else:
          continue
  </code></pre>
  <p>once i create a loop to go through the directory, how do I get it to extract and print the max values from the specified text files?</p>