Write a function to get list of profanity words from Google profanity URL


Topic: Write a function to get list of profanity words from Google profanity URL

Solution

def profanitytextfile():
    url = "https://github.com/RobertJGabriel/Google-profanity-words/blob/master/list.txt"
    html = urlopen(url).read()
    soup = BeautifulSoup(html, features="html.parser")
    textlist = []
    table = soup.find('table')
    trs = table.find_all('tr')
    for tr in trs:
        tds = tr.find_all('td')
        for td in tds:
            textlist.append(td.text)
    return textlist



List all Python Programs