Skip to content

How to check if image = entity[image_prop] is available or not? #46

Answered by dahlia
sumit-158 asked this question in Q&A
Discussion options

You must be logged in to vote

As Entity implements Mapping protocol, you can treat it as a kind of dictionary. Just use in operator:

>>> from wikidata.client import Client
>>> client = Client()
>>> entity = client.get('Q20145')
>>> image_prop = client.get('P18')
>>> image_prop in entity
True

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dahlia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #45 on August 04, 2022 17:28.