how to take CSV file input in list of tuples I have a .txt(data.txt) file containing csv data like:

X         Class
15.0001   Yes
18.00     NO
17.07     Yes


I need to make a function to return a list of tuples of each samples. So far I did:

import csv
def readAllData(str): 
    with open(str,'r') as f:
        f.readline()
        data=[tuple(line) for line in csv.reader(f)]
    return (data)


Output:

[('15.001\tYES',),
 ('18.00\tNo',),
 ('17.07\tYes',),]


I want:

[(15.001, Yes), (18.00, No), (17.07, Yes)]
Technically speaking, you do not have a CSV, you have a TSV. So I would take the time to split out each row accordingly and then build your tuple. 

In the line:

data=[tuple(line) for line in csv.reader(f)] return (data)


You need to replace csv.reader to handle tsv instead.