Deck to Quizlet’s import format. No class instantiation is needed.
Functions
export_to_quizlet(deck, output_path, format_type="full") → str
Write all cards in a deck to a .txt file that can be imported directly into Quizlet. Cards with an empty question field are silently skipped.
The
Deck object to export. All deck.cards are iterated in order.File system path for the output
.txt file. The file is created or overwritten. The parent directory must exist.Controls how each card is serialised. One of
"simple", "full", "compact", or "safe". See Format types below.A human-readable status string, e.g.
"Exported 42 cards (0 skipped) to:\n/path/to/file.txt".get_quizlet_preview(deck, format_type="full", max_rows=5) → str
Return a multi-line string preview of the first max_rows cards in the chosen format. Useful for showing the user what the export will look like before writing to disk.
The deck to preview.
Export format. Same options as
export_to_quizlet.Maximum number of cards to include in the preview.
Cards joined by double newlines (
\n\n) for readability. Empty questions are skipped.Format types
All formats separate the term (left side) from the definition (right side) with a tab character (\t), which is the standard Quizlet delimiter — except "safe" mode which uses custom string separators.
| Format | Term side | Definition side | Best for |
|---|---|---|---|
simple | {question} | {answer_text} | Clean flashcards with no option clutter |
full | {question} >> {options_joined} | {answer_text} | Preserving all options for study context |
compact | {question} [{options_joined}] | {answer_letters} | Letter-only answer recall |
safe | {[(CauHoi)]}{question}\n{options_lines} | {answer_text} | Decks with commas or tabs inside question text |
safe mode separators (configure these in Quizlet’s import dialog):
- Card separator:
{[(CauHoi)]} - Term/definition separator:
{[(DapAn)]}
In
safe mode, cards are concatenated without newlines between them. The {[(CauHoi)]} prefix on each card acts as the card separator when imported into Quizlet.Usage example
GeminiService
Extract flashcards from exam images using Gemini AI.
DedupService
Find and remove duplicate questions before exporting.