def countLine():
fileName='file'
f=open(fileName)
count = 0
for i in f:
if i.strip() != "":
count = count + 1
f.close()
return count
Tuesday, September 28, 2010
Monday, September 27, 2010
count line including linespace
def checkFile():
f=open("./file")
a=0
for line in f:
a = a + 1
f.close()
return a
f=open("./file")
a=0
for line in f:
a = a + 1
f.close()
return a
Sunday, September 26, 2010
count line without linespace
def countLineInFile():
f=open('./filename.txt')
line = f.readline()
lineNumber = 0
while line != "":
line = f.readline()
lineNumber = lineNumber + 1
f.close()
return lineNumber
f=open('./filename.txt')
line = f.readline()
lineNumber = 0
while line != "":
line = f.readline()
lineNumber = lineNumber + 1
f.close()
return lineNumber
Subscribe to:
Posts (Atom)