You are required to scrap data from imdb top 250 movies page. It should only have fields movie name, year, and rating.



You are required to scrap data from imdb top 250 movies page. It should only have fields movie name,..

Answer / Anamika

To scrape data from the IMDb top 250 movies page, you can use a web scraping library such as BeautifulSoup. Here's a basic example of how to extract movie name, year, and rating using BeautifulSoup and requests:nn```pythonnimport requestsnfrom bs4 import BeautifulSoupnnurl = 'https://www.imdb.com/chart/top/' nresponse = requests.get(url)nsoup = BeautifulSoup(response.content, 'html.parser')nnmovies = soup.find_all('td', {'class': 'titleColumn'})nnfor movie in movies[:25]:n name = movie.a['title']nyear = int(movie.find('span', {'class': 'secondaryInfo'}).text[1:5].strip())nrating = float(movie.strong.text)n print(f'{name} - {year} - Rating: {rating}')n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

Can a constructor be inherited?

1 Answers  


Explain list, tuple, set, and dictionary and provide at least one instance where each of these collection types can be used.

1 Answers  


what is random module will do in python and what are the functions we can apply on random module

1 Answers  


What are the use of tuples in python?

1 Answers  


How to install python and prepare environment?

1 Answers  


What is the output of the below program?

1 Answers  


Why do we need Python Directories

1 Answers  


What is py checker in python?

1 Answers  


Name a few methods for matching and searching the occurrences of a pattern in a given text string?

1 Answers  


What is difference between sort and sorted in python?

1 Answers  


What is += in python mean?

1 Answers  


What is a panda in python?

1 Answers  


Categories