📌  相关文章
📜  Python IMDbPY – XML 格式的公司信息

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

Python IMDbPY – XML 格式的公司信息

在本文中,我们将了解如何获取 XML 格式的公司信息。可扩展标记语言 (XML) 是一种标记语言,它定义了一组规则,用于以人类可读和机器可读的格式对文档进行编码。 Company 对象包含所有与电影行业相关的公司信息,并在 IMDb 数据库中有记录。

下面是实现

Python3
# importing the module
import imdb
  
# creating instance of IMDb
ia = imdb.IMDb()
  
# id
code = "0051941"
  
# getting information
company = ia.get_company(code)
  
# printing company
print(company)
 
print("--------------------------------")
 
# converting company object into XML file
xml_file = company.asXML()
 
# printing some part of the XML file
print(xml_file[:250])


Python3
# importing the module
import imdb
  
# creating instance of IMDb
ia = imdb.IMDb()
  
# id
code = "0022125"
  
# getting information
company = ia.get_company(code)
  
# printing company
print(company)
 
print("--------------------------------")
 
# converting company object into XML file
xml_file = company.asXML()
 
# printing some part of the XML file
print(xml_file[:100])


输出 :

Marvel Studios
--------------------------------

另一个例子

Python3

# importing the module
import imdb
  
# creating instance of IMDb
ia = imdb.IMDb()
  
# id
code = "0022125"
  
# getting information
company = ia.get_company(code)
  
# printing company
print(company)
 
print("--------------------------------")
 
# converting company object into XML file
xml_file = company.asXML()
 
# printing some part of the XML file
print(xml_file[:100])

输出 :

Pixel
--------------------------------