0

I am very new to Python and wish to get some help here, how can I detect if the function has reach the end of file?

    with open("employees.txt", "r") as a_file:
        d = a_file.tell()
        print(d)
        # open the file in reading mode
        # .tell()returns current location of the file pointer
        for x in a_file:
            print(x)

        # read through the file line by line


l_fun()```
helenz
  • 1
  • Not your question but just in case you are overcomplicating things: https://www.w3schools.com/python/ref_file_readlines.asp `readlines()` – Tin Nguyen Aug 11 '20 at 07:45
  • thanks for the link, read through before, but it doesn't tell how to detect the end of line? – helenz Aug 11 '20 at 08:22

0 Answers0