Get random words from a web page

With this script you can take words from a web page and take some of them randomly

from urllib.request import Request, urlopen
import random


url="https://svnweb.freebsd.org/csrg/share/dict/words?revision=61569&view=co"
req = Request(url, headers={'User-Agent': 'Mozilla/5.0'})

web_byte = urlopen(req).read()

webpage = web_byte.decode('utf-8')
first500 = webpage.split("\n")[:500]
f = random.sample(first500, 10)
print(f)
['administrable', 'Adlerian', 'acquiesce', 'Adamson', 'accumulate', 'Actaeon', 'abrade', 'abolish', 'afterthought', 'afoot']
Get some words from a web page
Getting words froma a web page

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.