Skip to content

Instantly share code, notes, and snippets.

@qtkite
Last active June 4, 2023 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qtkite/1b1301c64f4ad51dc424e2d549a99571 to your computer and use it in GitHub Desktop.
Save qtkite/1b1301c64f4ad51dc424e2d549a99571 to your computer and use it in GitHub Desktop.
minimal anki generator (basic deck)
file_headers = '#separator:tab\n#html:true\n'
separator = '\t'
class AnkiDeck:
def __init__(self) -> None:
self.deck = []
def add_card(self, front: str, back: str) -> None:
self.deck.append([front, back])
def generate_deck(self, file_name: str) -> None:
with open(file_name, 'w') as f:
f.write(file_headers)
for front, back in self.deck:
f.write(front + separator + back + '\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment