From 37656695d8d2ee89a8bfcc099e96001cac0dec4e Mon Sep 17 00:00:00 2001 From: Benjamin Dweck Date: Thu, 7 Sep 2023 14:20:31 +0300 Subject: [PATCH] fixed comma extra fields issue --- csv2ankicards.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/csv2ankicards.py b/csv2ankicards.py index 1d71443..db750df 100644 --- a/csv2ankicards.py +++ b/csv2ankicards.py @@ -21,9 +21,15 @@ MY_MODEL = genanki.Model( def csv_to_anki(csv_path, output_path): with open(csv_path, 'r', encoding='utf-8') as f: reader = csv.reader(f) + # Skipping the header row + next(reader, None) + my_deck = genanki.Deck(2059400110, "CSV Deck") for row in reader: - question, answer = row + # Use row directly without splitting + question = row[0] + answer = ",".join(row[1:]) + note = genanki.Note( model=MY_MODEL, fields=[question, answer]