使用打开的 csv 处理选项卡分隔文件 (csv)



我试图像这样创建我的阅读器:

CSVReader reader = new CSVReader(new FileReader("ping10102012.csv"), 't');
int i=0;
while ( (nextLine = reader.readNext()) != null){
    System.out.println(nextLine[i]); // Debug only
}

而且我在东西上遇到了一些问题。 我只从我的 csv 中获取第一个(列)值,它们输出的非常奇怪。

输出:

I  D
2  7  2  2  2
2  4  6  9  4
...more like this

这些列是:

单位标识

尝试

ACPower

等等。 感谢您的任何帮助!

您打印第一列的时间与i=0一样,分配给i的值没有变化。

试试这个:

         while ( (nextLine = reader.readNext()) != null){
            for(String value: nextLine){
               System.out.println(value); // Debug only
            }
        }

最新更新