This Python script converts Kindle highlights to Anki flashcards.
- Python 3.6+
- genanki library
- Clone this repository or download the
kindle_to_anki.py
script. - Install the required library:
pip install genanki
-
Export your Kindle highlights to a text file. You can do this by:
- Opening your Kindle device
- Navigating to "My Clippings.txt"
- Copying the contents to a new text file on your computer
-
Run the script with the following command:
python kindle_to_anki.py <input_kindle_file> <output_anki_file> "<deck_name>"
Replace the placeholders with your actual file names and desired deck name:
<input_kindle_file>
: The path to your Kindle highlights text file<output_anki_file>
: The desired name for your output Anki deck file (should end with .apkg)<deck_name>
: The name you want to give your Anki deck (use quotes if it contains spaces)
Example:
python kindle_to_anki.py example_input.txt my_kindle_highlights.apkg "My Kindle Highlights"
- Import the generated .apkg file into Anki.
The input file should contain Kindle highlights in the following format:
Book Title (Author)
- Your Highlight on page X | Location XXX-XXX | Added on Date
Highlighted text
You can find an example in the example_input.txt
file provided in this repository.
This script creates flashcards with the highlight on the front and the book details on the back. You may need to adjust the script if you want a different card format.