I use the following code segment to read a file in python:
with open (\"data.txt\", \"r\") as myfile: data=myfile.readlines()
Input fil
You could use:
with open('data.txt', 'r') as file: data = file.read().replace('\n', '')