Извлечение key_value в Python с несколькими столбцами с одинаковым именем в csv
I have below data in csv : A B C D A C D 1 2 1 4 4 6 9 8 13 12 19 84 I am using below code to extract key-value pair and see the output : import csv with open('sample.csv', 'r') as csv_file: reader = csv.reader(csv_file) for row in reader: print(row) However I am getting same output as csv file A B C D A C D 1 2 1 4 4 6 9 8 13 12 19 84 Process finished with exit code 0 But I need output like this : A B C D 1 2 1 4 9 4 8 6 13 12 19 84 Please help! As per your convenience here is the csv data and the code : CSV Data =================================== A,B,C,D,A,C,D 1,2,1,4,,, ,4,,6,9,8, 13,12,,,,19,84 Python Code : ==================================== import csv with open('sample.csv', 'r') as csv_file: reader = csv.reader(csv_file) for row in reader: print(row)
Что я уже пробовал:
Python Code : ==================================== import csv with open('sample.csv', 'r') as csv_file: reader = csv.reader(csv_file) for row in reader: print(row)