Python IMDbPY - 获取人的出生日期
在本文中,我们将了解如何获取任何人的出生日期,我们可以通过传递人员 ID 借助get_person
方法获取人员数据。
get_person
方法返回一个可以用作字典的 imdb Person 对象,即可以通过提供数据的键来查询它们,这里的键是出生日期。
Syntax : person[‘birth date’]
Here person is the Person object return by the get_person method.
Return : It return string which is birth date.
下面是实现。
# importing the module
import imdb
# creating instance of IMDb
ia = imdb.IMDb()
# person id
person_id = "1596350"
# getting person details
search = ia.get_person(person_id)
# printing the search
# printing name and birth date
print(search['name'] + " " +search['birth date'])
输出 :
Nawazuddin Siddiqui 1974-05-19
另一个例子
# importing the module
import imdb
# creating instance of IMDb
ia = imdb.IMDb()
# person id
person_id = "0000206"
# getting person details
search = ia.get_person(person_id)
# printing the search
# printing name and birth date
print(search['name'] + " " +search['birth date'])
输出 :
Keanu Reeves 1964-09-02