file = open('face.txt','r') filew = open('face1.txt','w') try: for line in file: print(line) if line.strip() !='': line = '"'+line.strip()+'"'+",\n" // 去掉空格、换行符 加上引号 逗号 换行符 filew.write(line) finally: file.close() filew.close()