Open In App

Python IMDbPY – Info set to keys of Person object

Last Updated : 06 Sep, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

In this article we will see how we can convert info set to keys, we can know info sets of movie by get_person_infoset, but even after getting the info set we are unable to use like dictionary. In order to use info set as dictionary keys we have to use infoset2keys method.

Syntax : person.infoset2keys Here movie is the imdb Person object Action performed : This will allow info set to use as dictionary keys

Below is the implementation 

Python3




# importing the module
import imdb
  
# creating instance of IMDb
ia = imdb.IMDb()
  
# ID
code = "4731677"
   
# searching the Id and getting info set
person = ia.get_person(code, info =['biography'])
 
# making infoset to use as keys
person.infoset2keys
 
# printing bio graphy
print(person['biography'])


Output :

[‘Ayushmann Khurrana was born on 14 September 1984 in Chandigarh, India. Ayushmann started off his career as a popular radio jockey, and eventually became a VJ on MTV India and one of the most popular hosts in India. He shot to stardom with the runaway hit, \’Vicky Donor\’ in 2012. His effortless act in his debut won him rave reviews and the film went on to become one of the biggest hits of the year. The quirky film coupled with some fabulous songs, especially \’Paani da\’ (sung & co-composed by Khurrana) marked his arrival in the Hindi film industry. He also won a slew of highly prestigious awards in 2012.A native of Punjab, Ayushmann studied at St. John\’s High School and DAV College in Chandigarh. He majored in English literature and has a master\’s degree in Mass Communication from School of Communication Studies, Punjab University, in Chandigarh. He did serious theatre for five years. He was also the founder member of DAV College\’s “Aaghaaz” and “Manchtantra”, which are active theatre groups in Chandigarh. He has conceptualized and acted in street plays, and won prizes in national college festivals like Mood Indigo (IIT Bombay), Oasis (Birla Institute of Technology and Science, Pilani) and St. Bedes Shimla. He also won a Best Actor award for playing Ashwatthama in Dharamvir Bharati\’s Andha Yug.From theatre to television to the big screen, Ayushmann\’s progression as an artist has been one of the most organic ones. He followed up his Vicky Donor act with some films where his performances were highly appreciated by the audience and critics alike. Ayushmann simultaneously built his oeuvre as a singer and live performer as well. His three singles – \’O Heeriye, \’ \’Mitti Di Khushboo, \’ and the latest, \’Yahin Hoon Main\’ – have won millions of hearts.::Nishanth’]

Another example 

Python3




# importing the module
import imdb
  
# creating instance of IMDb
ia = imdb.IMDb()
  
# ID
code = "2690647"
   
# searching the Id and getting info set
person = ia.get_person(code, info =['filmography'])
 
# making infoset to use as keys
person.infoset2keys
 
# printing filmo graphy
print(person['filmography'])


Output :

[{'actor': [Movie id:11261278[http] title:_Romeo (2020)_.......(2018)_]}]


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads