I would like to count lines in a file using the fileinput module and I am getting an unusual output. ------------------------------------------------------------------------------ #!/usr/bin/python import fileinput
# cycle through files for line in fileinput.input(): if (fileinput.isfirstline()): if (fileinput.lineno > 1): print "%8d lines" % (fileinput.lineno()-1) print "%s" % fileinput.filename() print "%8d lines" % fileinput.filelineno() --------------------------------------------------------------------------------- This works fine except it prints "0 lines" first. Can anyone help me understand why that is? -- http://mail.python.org/mailman/listinfo/python-list