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 can also strip each line and concatenate into a final string.
myfile = open("data.txt","r") data = "" lines = myfile.readlines() for line in lines: data = data + line.strip();
This would also work out just fine.