我有一个数据集文件 - >你在哪里
Exception
要在我的java应用程序中处理它,我需要将其转换为csv格式,其中我只需要movie_id和movie_name。
我正在编写java代码,将其转换为csv as
u.item -- Information about the items (movies); this is a tab separated
list of
movie id | movie title | release date | video release date |
IMDb URL | unknown | Action | Adventure | Animation |
Children's | Comedy | Crime | Documentary | Drama | Fantasy |
Film-Noir | Horror | Musical | Mystery | Romance | Sci-Fi |
Thriller | War | Western |
The last 19 fields are the genres, a 1 indicates the movie
is of that genre, a 0 indicates it is not; movies can be in
several genres at once.
The movie ids are the ones used in the u.data data set.
}
但是我收到以下错误
package com.convert;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class MovieDataConvert {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new FileReader("data/u.item"));
BufferedWriter bw = new BufferedWriter(new FileWriter("data/moviesItem.csv"));
String line;
while((line = br.readLine()) != null) {
String[] values = line.split("\\t", -1);
bw.write(values[0] + "," + values[1] + "\n");
}
br.close();
bw.close();
}
我做错了什么? enter image description here