title: Extract number from file name in python
body: <p>I have a directory where I have many data files, but the data file names have arbitrary numbers. For example</p>
  
  <pre><code>data_T_1e-05.d
  data_T_7.2434.d
  data_T_0.001.d
  </code></pre>
  
  <p>and so on. Because of the decimals in the file names they are not sorted according to the value of the numbers. What I want to do is the following:
  I want to open every file, extract the number from the file name, put it in a array and do some manipulations using the data. Example:</p>
  
  <pre><code>a = np.loadtxt("data_T_1e-05.d",unpack=True)
  res[i][0] = 1e-05
  res[i][1] = np.sum[a]
  </code></pre>
  
  <p>I want to do this for every file by running a loop. I think it could be done by creating an array containing all the file names (using <code>import os</code>) and then doing something with it.
  How can it be done?</p>