aa Flashcards

1
Q

Term

A

Definition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

’)
for row in rows:
if ‘

A

Read text from clipboard

’ in row:
term, definition = row.split(‘,’, 1) # Split only once to avoid ValueError
flashcards.append((term.strip(), definition.strip()))
else:
print(“Error parsing flashcard:”, row)
return flashcards

def export_to_csv(flashcards, filename):
with open(filename, ‘w’, newline=’’) as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerow([‘Term’, ‘Definition’])
for card in flashcards:
csvwriter.writerow(card)

clipboard_text = pyperclip.paste()

flashcards = parse_flashcards(clipboard_text)

export_to_csv(flashcards, ‘flashcards.csv’)

print(“Flashcards exported to flashcards.csv”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly