I use the following code segment to read a file in python:
with open (\"data.txt\", \"r\") as myfile: data=myfile.readlines()
Input fil
This can be done using the read() method :
text_as_string = open('Your_Text_File.txt', 'r').read()
Or as the default mode itself is 'r' (read) so simply use,
text_as_string = open('Your_Text_File.txt').read()