Open .dat and .atr file types with Python
Question: I'm trying to read in .dat and .atr files with Python; from Physionet, [these
for example](https://www.physionet.org/physiobank/database/mitdb/). I've tried
the standard context manager opening method:

    
    
    with open("path/to/files/101.dat", "rb") as f:
      for line in f: print f
    

But I get uninterpretable results like `D"D ?C?C?C!?C?C?C?C?C` for the lines.
These lines should be like `3.0000000e-003 4.9950000e+000 4.3400000e+000` (I
know this from published studies with this dataset). Any ideas how I can read
in this data?


Answer: You can try to open it [using
`numpy`](http://stackoverflow.com/a/11798898/5687152)

    
    
    import numpy as np
    myarray = np.fromfile("path/to/files/101.dat",dtype=float)
    

