import chardet
with open(files[0], 'rb') as file:
    print(chardet.detect(file.read()))