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 compress this into one into two lines of code!!!
content = open('filepath','r').read().replace('\n',' ') print(content)
if your file reads:
hello how are you? who are you? blank blank
python output