Question: Write a loop in python that can get the first 10 categories in python. Display on the first 10. In [20]: import newspaper In [21]:
Write a loop in python that can get the first 10 categories in python.
Display on the first 10.

In [20]: import newspaper In [21]: cnn_papernewspaper.build("http://www.cnn.com") In [46]: for article in cnn_paper.articles: print(article.url) In [28]: for category in cnn_ paper.category_urls(): print(category) http://www.cnn.com/more http://www.cnn.com/asia http://www.cnn.com http://www.cnn.com/accessibility http://www.cnn.com/world http://www.cnn.com/opinions http://www.cnn.com/business http://collection.cnn.com http://www.cnn.com/election https://money-cnn.com http://www.cnn.com/style http://www.cnn.com/transcripts http://www.cnn.com/politics http://www.cnn.com/middle-east http://ww.cnn.com/europe http://www.cnn.com/health http://www.cnn.com/entertainment http://www.cnn.com/vr http://www.cnn.com/uk http://tours.cnn.com http://www.cnn.com/travel http://ww.cnn.com/videos http://cnn. t http://www.cnn.com/australia http://www.cnn.com/africa http://www.cnn.com/americas http://www.cnn.com/us
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
