Hello everyone
I want to read the file content into a array, using the following
coding, but it doesnot work.
This is the content of the file:
[“11.txt”, “11.txt”, “11.txt”, “11.txt”, “22.txt”, “11.txt”, “22.txt”,
“11.txt”]
I want to convert it into a array, using the following codes:
str_a=""
f = open(file_array_duplicate)
f.each_line { |line| str_a << line }
f.close
a_s=str_a.gsub!(/[[]]/,’’).split(/\s*,\s*/)
but, the result is :
the array a_s content is:
:["[“11.txt”,", ““11.txt”,”, ““11.txt”,”, ““11.txt”,”,
““22.txt”,”, ““11.txt”,”, ““22.txt”,”, ““11.txt”]”]
Not that I wanted, likes
[“11.txt”, “11.txt”, “11.txt”, “11.txt”, “22.txt”, “11.txt”, “22.txt”,
“11.txt”]
Many thanks!