title: How to change names of a list of numpy files?
body: <p>I have list of numbpy files, I need to change their names, In fact, let's assume that I have this list of files:</p>
  
  <pre><code>AES_Trace=1_key=hexaNumber_Plaintext=hexaNumber_Ciphertext=hexaNumber.npy
  AES_Trace=2_key=hexaNumber_Plaintext=hexaNumber_Ciphertext=hexaNumber.npy
  AES_Trace=3_key=hexaNumber_Plaintext=hexaNumber_Ciphertext=hexaNumber.npy
  </code></pre>
  
  <p>What I need to change is the number of files,  as a result I must have:</p>
  
  <pre><code>AES_Trace=100001_key=hexaNumber_Plaintext=hexaNumber_Ciphertext=hexaNumber.npy
  AES_Trace=100002_key=hexaNumber_Plaintext=hexaNumber_Ciphertext=hexaNumber.npy
  AES_Trace=100003_key=hexaNumber_Plaintext=hexaNumber_Ciphertext=hexaNumber.npy
  </code></pre>
  
  <p>I have tried:</p>
  
  <pre><code>import os
  import numpy as np
  import struct
  path_For_Numpy_Files='C:\\Users\\user\\My_Test_Traces\\1000_Traces_npy'
  os.chdir(path_For_Numpy_Files)
  list_files_Without_Sort=os.listdir(os.getcwd())
  list_files_Sorted=sorted((list_files_Without_Sort),key=os.path.getmtime)
  for file in list_files_Sorted:
      print (file)
      os.rename(file,file[11]+100000)
  </code></pre>
  
  <p>I think that is not the good solution, firstly It doesn't work, then  it gives me this error:</p>
  
  <pre><code>os.rename(file,file[11]+100000)
  IndexError: string index out of range
  </code></pre>