站长资源脚本专栏
Python将文本去空格并保存到txt文件中的实例
简介如下所示:#encoding=utf-8#x=raw_input("Please enter a text: ")y=x.replace(" ","")f = open('Output.txt', 'w')print >>f, yf.close()以上这篇Python将文本去空格并保存到tx
如下所示:
#encoding=utf-8# x=raw_input("Please enter a text: ") y=x.replace(" ","") f = open('Output.txt', 'w') print f, y f.close()
以上这篇Python将文本去空格并保存到txt文件中的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。