fixed comma extra fields issue
This commit is contained in:
parent
3c7ee303a4
commit
37656695d8
|
@ -21,9 +21,15 @@ MY_MODEL = genanki.Model(
|
||||||
def csv_to_anki(csv_path, output_path):
|
def csv_to_anki(csv_path, output_path):
|
||||||
with open(csv_path, 'r', encoding='utf-8') as f:
|
with open(csv_path, 'r', encoding='utf-8') as f:
|
||||||
reader = csv.reader(f)
|
reader = csv.reader(f)
|
||||||
|
# Skipping the header row
|
||||||
|
next(reader, None)
|
||||||
|
|
||||||
my_deck = genanki.Deck(2059400110, "CSV Deck")
|
my_deck = genanki.Deck(2059400110, "CSV Deck")
|
||||||
for row in reader:
|
for row in reader:
|
||||||
question, answer = row
|
# Use row directly without splitting
|
||||||
|
question = row[0]
|
||||||
|
answer = ",".join(row[1:])
|
||||||
|
|
||||||
note = genanki.Note(
|
note = genanki.Note(
|
||||||
model=MY_MODEL,
|
model=MY_MODEL,
|
||||||
fields=[question, answer]
|
fields=[question, answer]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user