How can I get the card type?

What is the code to get the card type?

If I use print(card) I can get all ‘data’ but they don’t really differ much from card to card. For example: All cards have the same type ‘0’, how can I get the unique type for each card? I need to check if the given card have a specific type.

Do you mean the notetype? You have to query the card’s note for that.

Yes! Can you clarify on that?

What exactly? If you have a card id you can do it like this:

self.col.models.get(self.col.get_note(self.col.get_card(123456789).nid).mid)
2 Likes

I am getting the error AttributeError: 'Collection' object has no attribute 'get_note'

Try getNote instead. get_note is a recently added alias, which may not be available in your Anki.

2 Likes