summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xflashcards4
1 files changed, 3 insertions, 1 deletions
diff --git a/flashcards b/flashcards
index dae46f1..30b24ba 100755
--- a/flashcards
+++ b/flashcards
@@ -38,11 +38,13 @@ def extractCards(f):
match = re.match(cardRegex, l)
if match:
if front != "":
- cards.append([front, back])
+ cards.append([front.strip(), back.strip()])
back = ""
front = match.string[prefixLength:]
else:
back += l
+ # do the last front-back pair before returning
+ cards.append([front.strip(), back.strip()])
return cards
# Loops serving cards to the user until the program is exited