Arnaud Delobelle wrote: > The standard Python way is using enumerate() > > for i, line in enumerate(fp): > print "line number: " + lineno + ": " + line.rstrip() > I guess you meant to say : for lineno, line in enumerate(fp): print "line number: " + lineno + ": " + line.rstrip() Thanks.