📜  Python IMDbPY - 获取人的出生日期

📅  最后修改于: 2022-05-13 01:54:53.777000             🧑  作者: Mango

Python IMDbPY - 获取人的出生日期

在本文中,我们将了解如何获取任何人的出生日期,我们可以通过传递人员 ID 借助get_person方法获取人员数据。

get_person方法返回一个可以用作字典的 imdb Person 对象,即可以通过提供数据的键来查询它们,这里的键是出生日期。

下面是实现。

# 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