Python IMDbPY – Getting birth place of person
In this article we will see how we can get the birth place of the person from the person object, imdb person object act similar to dictionary therefore getting place of birth from person object is similar from getting required information from the dictionary.
In order to do this we have to do the following –
1. Get the person object with the help of id by using get_person method
2. Get the birht place from it using result[‘birth info’][‘birth place’] as keys
3. Print the result
Below is the implementation
# importing the moduleimport imdb # creating instance of IMDbia = imdb.IMDb() # person idcode = "1372788" # getting person ojectactor = ia.get_person(code) # printing object it prntts its nameprint(actor) # getting birth placeplace = actor['birth info']['birth place'] # printing the placeprint(place) |
Output :
Shahid Kapoor New Delhi, India
Another example
# importing the moduleimport imdb # creating instance of IMDbia = imdb.IMDb() # person idcode = "1596350" # getting person ojectactor = ia.get_person(code) # printing object it prntts its nameprint(actor) # getting birth placeplace = actor['birth info']['birth place'] # printing the placeprint(place) |
Output :
Nawazuddin Siddiqui Budhana, Muzaffarnagar, Uttar Pradesh, India
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


