there are 1910 lines in the file, but when i am trying to print number of lines, i am getting as 0, why? already the file handle is open, only when i am opening the file handle again after the count variable i am getting the proper value, why is this
fhandle=open('C:\\Users\\Gopi\\Documents\\Exercise Files\\mbox-short.txt','r')
for i in fhandle:
print(i)
#counting lines in a file
count=0
#fhandle=open('C:\\Users\\Gopi\\Documents\\Exercise Files\\mbox-short.txt','r')
for j in fhandle:
count=count+1
print('Number of lines in the file is',count)
Actual result 0 Expected result 1910