title: how to convert many .npz files to .mat files through for loop using python
body: <p>i need to convert many .npz files to .mat file using python. my files are arranged like datafile_1.npz,datafile_2.npz...etc i want to convert these to datafile_1.mat,datafile_2.mat files etc.Insofar i wrote a code but getting error AttributeError: 'str' object has no attribute 'items'...why this error i am unable to understand.I hope somebody will help.</p>
  <pre><code>import numpy as np
  import scipy.io
  import glob
  
  filpath=glob.glob('./datafile_*.npz')
  
  for file in filpath:
      #data = np.load('file',)
      scipy.io.savemat('filepath'+'.mat', mdict=file)
      print(data)
      
   
  </code></pre>