如何在Ruby中写入文件? [英] How to write to file in Ruby?

查看:92
本文介绍了如何在Ruby中写入文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从数据库中读取数据,然后将其保存在文本文件中。

如何在Ruby中执行此操作?在Ruby中是否有任何文件管理系统?

解决方案

Ruby File class 会给你 :: new :: open ,但是其父母 IO class < a>,深入到 #read #write


I need to read the data out of database and then save it in a text file.

How can I do that in Ruby? Is there any file management system in Ruby?

解决方案

The Ruby File class will give you the ins and outs of ::new and ::open but its parent, the IO class, gets into the depth of #read and #write.

这篇关于如何在Ruby中写入文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆