这可能是你正在寻找的:
import urllib
def download(url, bytes = 1024):
"""Copy the contents of a file from a given URL
to a local file.
"""
webFile = urllib.urlopen(url)
localFile = open(url.split('/')[-1], 'w')
localFile.write(webFile.read(bytes))
webFile.close()
localFile.close()
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1387 次 |
最近记录: |