You could just use it as
file1 = open('file1.txt', 'r')
for line in file1.read().splitlines():
compressed_keys.append(bytes.fromhex(line))
file1.close()
file2 = open('file2.txt', 'r')
for line in file2.read().splitlines()::
compressed_keys.append(bytes.fromhex(line))
file2.close()
Good Luck with your studies
