with open ("data.txt", "r") as myfile:
data = myfile.read().splitlines()
with open('data.txt', 'r') as file:
data = file.read().replace('\n', '')
# where f is the file alias
with open(r"path\to\file.txt", encoding='UTF8') as f:
contents = f.read()
print(contents)