Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个奇怪的 CSV 文件,它有两个分隔符:“\t”和“,”。
我以前用 解析CSV.parse("file", col_sep: "\t"),但现在我也必须用“,”分隔字段。
CSV.parse("file", col_sep: "\t")
任何建议如何实现?
尝试这个:
CSV.parse(File.read('csvfile').gsub("\t", ","), col_sep: ',')