#for example you have 4 column age,gender,name,adress #if you want to gender you should give "line[1]" for arraylist with open("train.tsv",encoding='utf8') as tsvfile: tsvreader = csv.reader(tsvfile, delimiter="\t") for line in tsvreader: print(line[1])
Here is what the above code is Doing:
1. We open the train.tsv file using the open() function.
2. We create a csv reader object using the csv.reader() function.
3. We iterate over the rows of the train.tsv file using a for loop.
4. We print the second column of each row.