> >>> def printLine(fh, num): # let's > ... c = 0 > ... for line in fh.xreadlines(): > ... c = c + 1 > ... if (line == num): > ... fh.seek(0) # > ... return line # Only returns if line == num but line is a string not a num... should check if c==num... Incidentally there's a potential bug in that you return None if the required line is never reached. Might be better to raise an exception instead? Alan G.