How do I open a CSV file in irb


#1

Hi Guys,

I’d like to better understand how file input and outputs work so I’d like to do some experimentation in the irb environment however I can’t figure out how to open the CSV file.

I know I should have “require “csv”” however when I type words = CSV.open(“wordlist.csv”) I get the following error: “Errno::ENOENT (No such file or directory @ rb_sysopen - wordlist.csv)”

does the file have to be saved in the same directory as irb?


#2

If it isn’t in the same directory as you start irb in then you need to provide the path to it.