將行寫入文件的正確方法? - 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
相關文章
相關標籤/搜索