本文介绍了Ruby 相当于 Python 的“dir"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Python 中,我们可以dir"一个模块,如下所示:
>>>进口重新>>>目录(重新)并且它列出了模块中的所有函数.在 Ruby 中是否有类似的方法可以做到这一点?
解决方案
据我所知不是很清楚,但你可以用
object.methods.sort
In Python we can "dir" a module, like this:
>>> import re
>>> dir(re)
And it lists all functions in the module. Is there a similar way to do this in Ruby?
解决方案
As far as I know not exactly but you get somewhere with
object.methods.sort
这篇关于Ruby 相当于 Python 的“dir"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!