13.18. Write Code Exercises

  1. Complete the following code that retrieves the file ‘romeo.txt’ from. Make changes to line 4 and 5.

    Complete the following code that retrieves the file ‘romeo.txt’ from. Make changes to line 4 and 5.

Complete the following code to extract an image ‘cover3.jpg’ from the URL ‘http://data.pr4e.org/cover3.jpg’ and host ‘data.pr4e.org’. There are 5 empty spaces.

Complete the following code that retrieves the text from ‘http://data.pr4e.org/clown.txt’, prints it and also prints the frequency of each word.

Complete the following code that retrieves the text from ‘http://data.pr4e.org/clown.txt’ and prints the frequency of each word.

Write a program to retrieve and print text from ‘http://data.pr4e.org/intro-short.txt” and print it.

Write a program to store image file from ‘http://data.pr4e.org/cover.jpg’ to your disk.

Write a program to store image file from ‘http://data.pr4e.org/cover.jpg’ to your disk.

Complete the following program to extract all url from the webpage using regex.

Write a program that retrives a txt file from ‘https://www.gutenberg.org/files/1342/1342-0.txt’ in several blocks of 100,000 characters, joins them and saves as ‘prideandprejudice.txt’ to disk and prints number of characters.

Write a program that retrives a txt file from ‘https://www.gutenberg.org/files/1342/1342-0.txt’ in several blocks of 100,000 characters, joins them and saves as ‘prideandprejudice.txt’ to disk and prints number of characters.

Write a program that retrives a txt file from ‘https://www.gutenberg.org/files/16/16-0.txt’ in several blocks of 100,000 characters, joins them and saves as ‘peterpan.txt’ to disk and prints number of characters.

Complete the following code to print all the image sources from the webpage. Use ‘img’ and ‘src’ as tags.

Complete the following code to print all the image sources from the webpage. Use ‘img’ and ‘src’ as tags.

Write code that extracts data from several parts of the ‘a’ tag from “http://www.dr-chuck.com/page1.htm” using BeautifulSoup and html.parser and print the tag, href, contents as well as all the attributes.

Before you keep reading...

Making great stuff takes time and $$. If you appreciate the book you are reading now and want to keep quality materials free for other students please consider a donation to Runestone Academy. We ask that you consider a $10 donation, but if you can give more thats great, if $10 is too much for your budget we would be happy with whatever you can afford as a show of support.

You have attempted 1 of 16 activities on this page