f = open('./result/new.xml','a+') for line in content: text = ['\n',line,'\n'] f.writelines(text) print text