I have a problem with .dat files in Python: I can not encode it. I have tried UTF-8, ASCII and many more.
import re
with open("mixture1.dat",'r', encoding="ascii", errors="surrogateescape") as f:
    lines = f.readlines()
    text = "".join(lines)
print(text)
Here is the link for the "mixture1.dat". There should be something related in chemistry but I could not open it for a week. How should I do it?
EDIT: SOLUTION
import pickle
def read_file(filename):
    with open(filename,  'rb')  as  FID:
        mp  = pickle.Unpickler(FID)
        data = mp.load()
    return data
Worked fine
 
    