Python IMDbPY – 获取系列年
在本文中,我们将看到如何获得系列的系列年份。系列年份基本上说明了该系列的间隔,即发行年份和最后一集播出的年份。如果该系列尚未结束,它将仅显示发布年份。
In order to get this we have to do the following –
1. Get the series details with the help of get_movie method
2. As this object will act as dictionary therefore we have to filter the object
3. Get the main data of object with the help of data method which will return dictionary
4. Get the series year from the dictionary
下面是实现
# importing the module
import imdb
# creating instance of IMDb
ia = imdb.IMDb()
# id
code = "0903747"
# getting information
series = ia.get_movie(code)
# getting series year of the series
years = series.data['series years']
# printing the object i.e name
print(series)
# print the series year
print(years)
输出 :
Breaking Bad
2008-2013
另一个例子
# importing the module
import imdb
# creating instance of IMDb
ia = imdb.IMDb()
# id
code = "6468322"
# getting information
series = ia.get_movie(code)
# getting series year of the series
years = series.data['series years']
# printing the object i.e name
print(series)
# print the series year
print(years)
输出 :
Money Heist
2017-