使用 python 下载文件

Download file using python

我正在尝试使用 Python 下载 SWF 文件, 但出于某种原因,每次我使用 urllib.urlretrieve(url,filepathwithname) 或 wget.download(url) 时,它都会说:

File "C:\Users\User-PC\Desktop\check.py", line 3, in <module>
response = 
urllib.urlretrieve('www.domain.com\folder\folder\52sd1399sc2emaple-story-
vthree-f.swf','file.swf')
File "C:\Python27\lib\urllib.py", line 98, in urlretrieve
return opener.retrieve(url, filename, reporthook, data)
File "C:\Python27\lib\urllib.py", line 245, in retrieve
fp = self.open(url, data)
File "C:\Python27\lib\urllib.py", line 213, in open
return getattr(self, name)(url)
File "C:\Python27\lib\urllib.py", line 469, in open_file
return self.open_local_file(url)
File "C:\Python27\lib\urllib.py", line 483, in open_local_file
raise IOError(e.errno, e.strerror, e.filename)
IOError: [Errno 2] The system cannot find the path specified: 
'www.domain.com\folder\folder\52sd1399sc2emaple-story-vthree-f.swf'

虽然 wget 行在 运行 单独文件中的行仍然给出相同的错误而不是我的代码(它在没有该下载行的情况下运行完美),但它有时确实有效,但 wget 永远无法使用我放置的 swf 链接。

*注。我输入的字符串是"www.domain.com\folder\foldersd1399sc2emaple-story-vthree-f.swf",错误包含"www.domain.com\folder\foldersd1399sc2emaple-story-vthree-f.swf".

请帮忙。

@Blckknght 你太棒了。这就是整个问题。感谢所有试图提供帮助的人!

整个问题是 urlretrieve link 中缺少 http://...我花了将近 10 个小时尝试使用 wget 和其他方法解决该问题,@Blckknght 刚刚解决了它为了我。 =)

祝你一切顺利,祝你有美好的一天 -CodingCode.