1#!/usr/bin/env python3 2 3import urllib.request 4import shutil 5import sys 6import os 7 8os.makedirs(os.path.dirname(sys.argv[2]), exist_ok=True) 9 10with urllib.request.urlopen(sys.argv[1]) as response, open(sys.argv[2], 'wb') as out_file: 11 shutil.copyfileobj(response, out_file) 12