July 2022 Computer Sciences: Programming (CIS1048-N) by Teesside University
Worksheet 8 Networking Programming
[ASSESSMENT] Question 2: A Keyword Filter (keyword_filter.py) Let’s now write a program to check whether or not a webpage contains certain keywords, without showing the webpage to the user.
- Write a program that asks the user for the address of a webpage.
- Now, read a list of “blocked words” from a file blocked_words.txt line-by-line.
- Download the contents of that webpage to a string, and print a message that access to the webpage has been blocked if the webpage’s source code contains any word in blocked_words.txt.