edit text file using python,sys.stdout.write(line)