flashcard: Python flash card self-testing script

flashcard is a tiny Python script that lets you quiz yourself on vocabulary words or other simple facts you're trying to learn.

(This is a command-line program -- it doesn't pop up a window or anything like that. Download the script then run it like this: python flashcard or python flashcard wordlist.)

Get version 0.3 here

Set up flash card sets in ~/.flashcards/filename where each filename defines an array called cards, like this:

cards = [
    [ "1", "one" ],
    [ "2", "two" ],

Creating flash card sets

Create a directory (folder) called .flashcards in your home directory (that's /home/yourname on Linux, /Users/yourname on Mac, and, I think, C:\Documents & Settings\yourname on Windows) and put your card sets there. If you don't like folders starting with '.', as of version 0.3 you can use just "flashcards" without the dot. The program will look for a file called all as a default, so use that if you only want a single list of flashcards. If you want several sets, you can pass a filename as an argument, e.g. flashcard shortlist will use the cards defined in .flashcard/shortlist

(If you're on Windows and it can't find your flash cards, let me know. I've only tested it on Linux and Mac, but in theory it should work on Windows too.)

Running it

When you run flashcard, it will present one word from each set (for instance, "1" or "two" in the example above). Think of the answer (don't type it) and hit return. flashcard will print out the answer, e.g. "1" and "one", then wait for input.

If you got the answer right, hit return to be presented with another card. If you got it wrong, typing anything else before you hit return will cause that card to be remembered: wrong choices are more likely to be presented again (to help you learn them) and you'll be presented with a list of cards you got wrong when you exit, in case you want to save them for later study.

Starter card sets: Here are a few sets of Spanish vocabulary flash cards that I'm currently using: the full Speed Spanish 1 list, plus some extra words contributed by Julie.

If you like this program, feel free to contribute any useful flash cards sets, and I'll make them available here or link to them on your site!

Cards aren't limited to only two entries each: if you so choose, you can have cards like

    [ "1", "one", "uno", "un", "ichi" ],

You may notice that the program specifies coding: utf-8. That makes it possible for Python to handle characters like the accented characters in Spanish. However, if you're running it in an English language terminal, you may still not see the accented characters. If that's the case, you might try:

LANG=es.UTF-8 flashcard


Probably it would be good if flashcard had a -a option to combine all the sets currently in $HOME/.flashcard, but I really should be studying my Spanish flash cards rather than writing more enhancements for this program, so that'll have to wait.

Writting those darned accented characters

Since I don't know how to type accented characters, I wrote a little python script called escribo that provides buttons for all the common Spanish special characters and copies that character to the clipboard, so you can paste it anywhere.

More software
Shallow Sky Home
Mail me