Question

——The the below .py script prints HTML of the webpage at the given URL. Alter the...


——The the below .py script prints HTML of the webpage at the given URL.
Alter the below code to print out the first 10 links on the URL:
https://www.orionscache.com/books


import requests
from bs4 import BeautifulSoup
myres = requests.get("https://www.orionscache.com/books")
soup = BeautifulSoup(myres.text, "html.parser")
print(soup)

Homework Answers

Answer #1

import requests

from bs4 import BeautifulSoup

myres = requests.get("https://www.orionscache.com/books")

soup = BeautifulSoup(myres.text, "html.parser")

count = 0

for my_links in soup.findAll('a'):

if count == 10:

    break

print(my_links.string)

count = count + 1

==========================================================
SEE OUTPUT / IMAGE for Indentation



Thanks, PLEASE COMMENT IF THERE IS ANY CONCERN.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
JAVASCRIPT/HTML: Please read 10 numbers that are listed below, edit the code given to sort the...
JAVASCRIPT/HTML: Please read 10 numbers that are listed below, edit the code given to sort the numbers from least to greatest, and then print those numbers. 10 numbers = { 9, 3, 2, 1, 10, 30, 4, 6, 7, 8} Submit the code and a screenshot of the output. [Reference JavaScript code] <html> <body> <H1>prompt()</h1> <p id="pro"></p> <script> // Array creation var num= new Array(); var ix = 0; // Read 10 numbers for (ix = 0; ix < 10;...
[Lab Task HTML/JAVASCRIPT] Please read 10 numbers that are list below, sort the numbers and then...
[Lab Task HTML/JAVASCRIPT] Please read 10 numbers that are list below, sort the numbers and then print those numbers. 10 numbers = { 9, 3, 2, 1, 10, 30, 4, 6, 7, 8} Output should have a sorted list [Reference JavaScript code] <html> <body>     <H1>prompt()</h1>     <p id="pro"></p>     <script>        // Array creation        var num= new Array();               var ix = 0;        // Read 10 numbers        for (ix = 0; ix < 10; ix++)...
you're tasked with performing a sentiment analysis on top articles in a sub-rddit. If you are...
you're tasked with performing a sentiment analysis on top articles in a sub-rddit. If you are unfamiliar with Reddit, here are some API urls to a few sub-rddits: - `worldnews` URL: https://www.rddit.com/r/worldnews/top.json - `writingprompts` URL: https://www.rddit.com/r/writingprompts/top.json - `todayilearned` URL: https://www.rddit.com/r/todayilearned/top.json - `explainlikeimfive` URL: https://www.rddit.com/r/explainlikeimfive/top.json - `politics` URL: https://www.rddit.com/r/politics/top.json From these URLs you should be able to figure out the pattern for any sub-rddit such as `news`, or `ama`. Start by getting the Rddit API to work, for the URL above...
Section 1.1: Creating the First Table Locate the HTML comment that reads "table 1" just below...
Section 1.1: Creating the First Table Locate the HTML comment that reads "table 1" just below the opening body tag. Add a table tag with the following specifications using the style attribute and CSS: width with a value of 650 pixels a margin set to auto – this will center the table within the web page a border set to none - this removes the table border Add a table row (<tr>) Add a table data container tag (<td></td>) Within...
PYTHON : Create a Email Address Parser (* Please do make comments*) Often times, you may...
PYTHON : Create a Email Address Parser (* Please do make comments*) Often times, you may be given a list of raw email addresses and be asked to generate meaningful information from such a list. This project involves parsing such a list and generating names and summary information from that list. The script, eparser.py, should: Open the file specified as the first argument to the script (see below) Read the file one line at a time (i.e., for line in...
Base Conversion One algorithm for converting a base 10 number to another base b involves repeatedly...
Base Conversion One algorithm for converting a base 10 number to another base b involves repeatedly dividing by b. Each time a division is performed the remainder and quotient are saved. At each step, the dividend is the quotient from the preceding step; the divisor is always b. The algorithm stops when the quotient is 0. The number in the new base is the sequence of remainders in reverse order (the last one computed goes first; the first one goes...
Strings The example program below, with a few notes following, shows how strings work in C++....
Strings The example program below, with a few notes following, shows how strings work in C++. Example 1: #include <iostream> using namespace std; int main() { string s="eggplant"; string t="okra"; cout<<s[2]<<endl; cout<< s.length()<<endl; ​//prints 8 cout<<s.substr(1,4)<<endl; ​//prints ggpl...kind of like a slice, but the second num is the length of the piece cout<<s+t<<endl; //concatenates: prints eggplantokra cout<<s+"a"<<endl; cout<<s.append("a")<<endl; ​//prints eggplanta: see Note 1 below //cout<<s.append(t[1])<<endl; ​//an error; see Note 1 cout<<s.append(t.substr(1,1))<<endl; ​//prints eggplantak; see Note 1 cout<<s.find("gg")<<endl; if (s.find("gg")!=-1) cout<<"found...
Homework Draw class diagrams for your HW4 - the Tetris Game shown below: Part 1: UML...
Homework Draw class diagrams for your HW4 - the Tetris Game shown below: Part 1: UML As a review, Here are some links to some explanations of UML diagrams if you need them. • https://courses.cs.washington.edu/courses/cse403/11sp/lectures/lecture08-uml1.pdf (Links to an external site.) • http://creately.com/blog/diagrams/class-diagram-relationships/ (Links to an external site.) • http://www.cs.bsu.edu/homepages/pvg/misc/uml/ (Links to an external site.) However you ended up creating the UML from HW4, your class diagram probably had some or all of these features: • Class variables: names, types, and...
for the scenario below: 1) Apply the qualitative analysis by identifying at least 3 issues in...
for the scenario below: 1) Apply the qualitative analysis by identifying at least 3 issues in the above process. Analyse these issues by using a. Adding-value and Waste Analysis b. Issue register, If you find that there are more than three issues, you can focus on the three issues that have the highest impact. 2). Calculate the cycle time efficiency of the as-is process. You can assume a working week of 40 hours. In case there is missing information, you...
Item 1 In the case below, the original source material is given along with a sample...
Item 1 In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button. Original Source Material Student Version When instructors are creating discussion board activities for online courses, at least two questions must be answered. First, what is the objective of the discussions? Different objectives might be to create a "social presence" among students so that they do not feel isolated, to ask...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT