Solution:
I understand that you wanted to read a file as input by your program. If I am not wrong you asked the question, which method will return an empty string when it reached the end of the file.
When a program reaches the (EOL) end of the line the .read() method returns an empty string whether the input file has a string or not.
f = open('test_file.txt')
>>> f.read() # reading the entire file
'Test File has data.'
>>> f.read() # Here you've reached the end of the file
''
f.read() function return (‘ ‘). Here the program reached the end of the file.
I hope this will help you. To understand the .read() function better, follow the LINK