Q. Write a program to display all the records in a file along with line / record number.


Answer :-


fh = open("Result.det", "r")
count = 0
rec = ""
while True :
    rec = fh.readline()
    if rec == "":
        break
    count = count + 1

print(count, rec, end = '')
fh.close()

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post