python 输入一篇多行文章,其中怎么去除行间的空白

2025-04-15 01:43:08
推荐回答(1个)
回答1:

with open('test.txt')as f:#先创建一个txt把你的文本输进去
    result=f.read()#获得数据
print(result.replace('\n',''))#替换掉换行符输出
#failure is probably the fortification in your poleit is like a peek your wallet as the thief when youare thinking how to spend several hard-won leptawhen you are wondering whether new money it has laidbackground because of you then at the heart of themost lax alert and most low awareness and left itgodsend failed