Skip to content
Related Articles

Related Articles

Improve Article
Python IMDbPY – Retrieving person using person ID
  • Last Updated : 22 Apr, 2020

In this article we will see how we can retrieve the data of person using its person ID, person id is the unique id given to each person by IMDb. We can use search_person method to search the persons by their name but it gives many people as they have same names therefore retrieving a person by its id is a better option.

In order to search a person by its id we use get_person method.

Syntax : imdb_object.get_person(id)

Argument : It takes string as argument which is person id

Return : It returns imdb Person object.



Below is the implementation.




# importing the module
import imdb
   
# creating instance of IMDb
ia = imdb.IMDb()
   
# ID
code = "4731677"
   
# searching the Id
search = ia.get_person(code)
  
# printing the search
print(search)

Output :

Ayushmann Khurrana

Another example




# importing the module
import imdb
   
# creating instance of IMDb
ia = imdb.IMDb()
   
# ID
code = "2690647"
   
# searching the Id
search = ia.get_person(code)
  
# printing the search
print(search)

Output :

Pankaj Tripathi

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :