📜  Python IMDbPY – XML 格式的系列信息

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

Python IMDbPY – XML 格式的系列信息

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

下面是实现

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


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


输出 :

Mirzapur
--------------------------------

另一个例子

Python3

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

输出 :

Sacred Games
--------------------------------