本文介绍了附加到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我将数据附加到文件中。我希望每次运行脚本时都会从换行符发生这种情况。例如。

file1.txt包含


一个quickcfsgggdra ertge

Brown fox s; ofj; ekf; okfo

跳过sldkfhlrigje


现在我想追加来自file2.txt的以下数据


超过懒狗


现在file1.txt应该看起来像


一个快速的电子邮件

Brown fox s; ofj; ekf; okfo

跳过sldkfhlrigje

超过懒狗


请建议code!

Hi
I am appending the data to a file . I want this to happen from a newline everytime the script is run.For eg.
the file1.txt contains

A quickcfsgggdra ertge
Brown fox s;ofj;ekf;okfo
jumped sldkfhlrigje

Now I want to append the follwoing data from file2.txt

over the lazy dog

now file1.txt should look like

A quickcfsgggdra ertge
Brown fox s;ofj;ekf;okfo
jumped sldkfhlrigje
over the lazy dog

Please suggest the code!

推荐答案

展开 | 选择 | Wrap | 行号


展开 | 选择 | Wrap | 行号




为什么这是首选?


即使perdoc网站上的示例也不使用3参数形式:

Why is that preferred?

Not even the examples on the perdoc site use the 3 argument form:

展开 | 选择 | Wrap | 行号


这篇关于附加到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 02:59