将行写入文件的正确方法? - Correct way to write line to file?

问题:

I'm used to doing print >>f, "hi there" 我习惯于print >>f, "hi there" this

However, it seems that print >> is getting deprecated. 可是,彷佛print >>已被弃用。 What is the recommended way to do the line above? 推荐使用哪一种方法进行上述操做? spa

Update : Regarding all those answers with "\\n" ...is this universal or Unix-specific? 更新 :关于全部带有"\\n"答案...这是通用的仍是Unix专用的? IE, should I be doing "\\r\\n" on Windows? IE,我应该在Windows上执行"\\r\\n"吗? .net


解决方案:

参考一: https://stackoom.com/question/PqTE/将行写入文件的正确方法
参考二: https://oldbug.net/q/PqTE/Correct-way-to-write-line-to-file
相关文章
相关标签/搜索