I am using the following code to download rfc pages. I am however getting
only html and not plain English text like on the webpage http://www.ietf.org/rfc/rfc2324.txt
In the command prompt I type:
python "RFC-Downloader.py" 2324 | more
only html and not plain English text like on the webpage http://www.ietf.org/rfc/rfc2324.txt
In the command prompt I type:
python "RFC-Downloader.py" 2324 | more
import sys, urllib.request try: rfc_number = int(sys.argv[1]) except (IndexError, ValueError): print('Must supply an RFC number as first argument') sys.exit(2) template = 'http://www.ietf.org/rfc/rfc{}.txt' url = template.format(rfc_number) rfc_raw = urllib.request.urlopen(url).read() rfc = rfc_raw.decode() print(rfc)