You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

9 lines
248 B
Python

import requests
# TODO add error handling logic for request
def count_words(url):
response = requests.get(url, timeout=5)
word_count = len(response.text.split(" "))
print(f"There are {word_count} words in {url}")
return word_count