I am trying to create a script which scrapes a website for phrases which gets saved to a list and then displayed in a randomized manner. Here's the code-
from bs4 import BeautifulSoup
import requests
import random
url = 'https://www.phrases.org.uk/meanings/phrases-and-sayings-list.html'
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html.parser')
for phrase in soup.find_all(class_='phrase-list'):
phrase_text = phrase.text
print(phrase_text)
This shows up the entire list of phrases that are scraped. How can I randomly show one phrase from the list of all phrases?