当前位置:主页 > 软件编程 > Python代码 >

Python将文本去空格并保存到txt文件中的实例

时间:2022-01-16 08:52:52 | 栏目:Python代码 | 点击:

如下所示:

#encoding=utf-8#
 
x=raw_input("Please enter a text: ")
y=x.replace(" ","")
f = open('Output.txt', 'w')
print >>f, y
f.close()

您可能感兴趣的文章:

相关文章