Python IMDbPY – Info set to keys of Person object

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

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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'])

chevron_right


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 Simla. 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

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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'])

chevron_right


Output :

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

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.