如何解决没有这样的文件或目录@rb sysopen
我的程序中有一条错误消息,我不明白为什么。我在谷歌上做了一些关于什么是“require 'open-uri' 缺失的研究,但正如你在我下面的代码中看到的那样,它被很好地包含在内。这是我的错误消息,在我的代码下方。
我的错误:
app.rb:10:in `initialize': No such file or directory @ rb_sysopen - https://coinmarketcap.com/all/views/all/ (Errno::ENOENT)
from app.rb:10:in `open'
from app.rb:10:in `<main>''
我的代码:
require 'nokogiri'
require 'open-uri'
puts "Wait a second data is coming..."
PAGE_URL = "https://coinmarketcap.com/all/views/all/"
page = Nokogiri::HTML(open("https://coinmarketcap.com/all/views/all/"))
currency_name_array = page.xpath("//tr/td/a[contains(@class,'currency-name-container')]/text()").map {|x| x.to_s }
currency_value_array = page.xpath("//tr/td/a[contains(@class,'price')]/text()").map {|x| x.to_s }
currency_result = Hash[currency_name_array.zip(currency_value_array)]
puts currency_result
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。