You could use:

with open('data.txt', 'r') as file:
    data = file.read().replace('\n', '')