from urllib import request import html2text url = 'https://duckduckgo.com' text = request.urlopen(url).read().decode('utf8') print(html2text.html2text(text))