Python IMDbPY – 搜索公司
在本文中,我们将了解如何在 IMDb 数据库中搜索公司,IMDb 数据库中存在许多与电影行业相关的公司,例如漫威工作室、迪士尼等。
为了搜索公司,我们将使用 search_company 方法。
Syntax : imdb_object.search_company(company_name)
Argument : It takes string as argument.
Return : It returns list of all similar named company.
下面是实现。
Python3
# importing the module
import imdb
# creating instance of IMDb
ia = imdb.IMDb()
# name of the person
company_name = "Marvel Studios"
# searching the name of the person
search = ia.search_company(company_name)
# printing the result
for i in search:
print(i)
Python3
# importing the module
import imdb
# creating instance of IMDb
ia = imdb.IMDb()
# name of the person
company_name = "Alt Bala ji"
# searching the name of the person
search = ia.search_company(company_name)
# printing the result
print(search)
输出 :
Marvel Studios
Barvel Studios
Marvelous 1st Studio
Next Level Studios
Boss Level Studios
Caravel Studios
Land Marvel Animation Studios
另一个例子:
Python3
# importing the module
import imdb
# creating instance of IMDb
ia = imdb.IMDb()
# name of the person
company_name = "Alt Bala ji"
# searching the name of the person
search = ia.search_company(company_name)
# printing the result
print(search)
输出 :
[Company id:0642697[http] name:_ALTBalaji [in]_, Company id:0779280[http] name:_ALT Balaji [in]_]