I\'m currently reading a file and importing the data in it with the line:
# Read data from file.
data = np.loadtxt(join(mypath, \'file.data\'), unpack=True)
Try
import os
[os.path.join(root, f) for root, _, files in os.walk(mypath)
for f in files
if f.startswith('file') and f.endswith('.data')]
It'll return a list of all files file*.data
, in case there are more than one. You can just iterate through them. If there is only one file, then just put [0]
at then end of the list comprehension.