两部分问题.我试图从互联网档案下载多个存档的Cory Doctorow播客.旧的那个没有进入我的iTunes提要.我编写了脚本,但下载的文件格式不正确.
Q1 - 我如何更改下载zip mp3文件?Q2 - 将变量传递到URL的更好方法是什么?
# and the base url.
def dlfile(file_name,file_mode,base_url):
from urllib2 import Request, urlopen, URLError, HTTPError
#create the url and the request
url = base_url + file_name + mid_url + file_name + end_url
req = Request(url)
# Open the url
try:
f = urlopen(req)
print "downloading " + url
# Open our local file for writing
local_file = open(file_name, "wb" + file_mode)
#Write to our local file
local_file.write(f.read())
local_file.close()
#handle errors
except HTTPError, e: …
Run Code Online (Sandbox Code Playgroud) 我正在尝试从 Google Drive 下载特定文件夹。
我试过这个例子 http://www.mwclearning.com/?p=1608但它从 G-Drive 下载所有文件。
例如:如果我在 Google Drive 中有两个文件夹,请说..
如果我想下载文件夹 A 则只应下载 1 、 2 个文件。
任何建议或帮助都可能非常有帮助。
提前致谢。
有一个包含日志的站点,每个日志都是zip(节省空间).我如何从网站下载?
(urllib/urllib2)(?)