Write a function Display () which will open the binary file story.txt and returns the total no of lines in that file
Answers
Answered by
0
Answer:
# Opening a file
file = open("gfg.txt","r")
Counter = 0
# Reading from file
Content = file.read()
CoList = Content.split("\n")
for i in CoList:
if i:
Counter += 1
print("This is the number of lines in the file")
print(Counter)
Similar questions