I'm currently attempting to import a list of numbers from a csv file as tuples, to look like this:
[(60, 20), (100, 55), (50, 40), (20, 70), (95, 85)])
def tuples(filename):
import csv
with open(filename) as csvfile:
rdr = csv.reader(csvfile)
next(rdr, None)
my_list = [tuple(filter(None, row)) for row in rdr]
print(my_list)
tuples("tuple.csv")
However at the moment my output is: [('60', '20'), ('100', '55'), ('50', '40'), ('20', '70', ' '), ('95', '85')]
How can I format my code to get rid of the quotation marks, and the empty field. Any help would be appreciated.