Flashcards

While revisiting some arabic vocabulary on quizlet I decided that the best way to learn was to brainwash myself by listening to the flashcards on repeat. Unfortunately, it does not provide a brainwash function so I had to do it myself. Thankfully, quizlet’s view of all cards in a set is easily copyable and formats each card’s front and back in a separate line.

import gtts
with open("adjectives", "r") as f:
    with open("adjectives.mp3", "wb") as fb:
        for ar in f:
            ar = ar.strip()
            en = next(f).strip()
            print(en)
            gtts.gTTS(ar, lang="ar").write_to_fp(fb)
            gtts.gTTS(en, lang="en").write_to_fp(fb)