Use Julia to read the list of paths from txt and open it

I have a txt file with multiple csv paths, for example a Links.txt file containing

/home/someone/something/aplha1.csv    
/home/someone/something/aplha2.csv
/home/someone/something/aplha3.csv
/home/someone/something/aplha4.csv

      

I would like to read the file line by line using Julia Lang and then for each line to read the csv file. I am using the below code

open("Links.txt") do f
  for line in eachline(f)
  rawnames = readcsv(line)
  println("read line: ", line)
  end
end

      

Sorry, I am getting the error

ERROR: opening file /home/someone/something/aplha1.csv
: No such file or directory

      

Any ideas?

THH!

+3


source to share


1 answer


The problem line

contains an end-of-line character at the end. Try changing it to



readcsv(chomp(line))

      

+5


source







All Articles