Code for getting content in a card's field?

Hi, I’m trying to make my own anki add-on. Although I’ve used python a lot for data science before, I’m pretty new to qt and OOP in general.

I’ve been spending hours trying to understand the structure of anki’s github, so I’m sorry to ask such a simple question, but how do I retrieve the information in a cards field (while reviewing)?

I thought it would be something like this…

from aqt import mw
mw.reviewer.card

so I’m not mistaken, up to this point, I’ve grabbed the card object for which the user is currently reviewing… how do I retrieve the information in a certain field?

Thanks

1 Like

banged my head against the wall for hours
posted to the forum
figured it out 2 minutes later.

for anyone in the future:

mw.col.getNote(mw.reviewer.card.nid)['nameOfTheField']

2 Likes

Or even shorter, mw.reviewer.card.note()['nameOfTheField']. :slightly_smiling_face:

6 Likes

Haha the joys of programming no? xD