Last active
June 4, 2023 12:34
-
-
Save pgkt04/1b1301c64f4ad51dc424e2d549a99571 to your computer and use it in GitHub Desktop.
minimal anki generator (basic deck)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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