I am trying to get a line count of a file using command prompt. However when I execute the code I get the output of 0.
import sys
file = open(sys.argv[1],"r")
lines=0
line=file.readline()
while line !="":
lines=lines+1
line=file.readline()
print("Lines:"+str(lines)+"\n")
file.close()
This code works perfectly fine, the lines inside the file was deleted.And that caused the output of 0