Skip to content
Related Articles

Related Articles

Improve Article

Python IMDbPY – Getting top 250 movies

  • Last Updated : 22 Apr, 2020

In this article we will see how we can retrieve the information of top 250 movies in IMDb database, IMDb sets ratings to all the movies.

In order to get the top 250 movies by IMDb we will use get_top250_movies method.

Syntax : imdb_object.get_top250_movies()

Argument : It takes no argument

Return : It returns list of 250 element and each element is idbm movie object



Below is the implementation




# importing the module
import imdb
   
# creating instance of IMDb
ia = imdb.IMDb()
   
# getting top 250 movies
search = ia.get_top250_movies()
  
# printing only first 10 movies title
for i in range(10):
    print(search[i]['title'])

Output :

The Shawshank Redemption
The Godfather
The Godfather: Part II
The Dark Knight
12 Angry Men
Schindler's List
The Lord of the Rings: The Return of the King
Pulp Fiction
The Good, the Bad and the Ugly
The Lord of the Rings: The Fellowship of the Ring

 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. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :