Iterating on a file using Python,f.seek(0)