Currently have this working and its downloading the files correctly but is placing them in the same folder where it is being ran from, but how would i go about say moving these to c:\downloads or something like this?
目前有这个工作和它正确下载文件,但是将它们放在运行它的同一个文件夹中,但我怎么会说将它们移动到c:\ downloads或类似的东西?
urllib.urlretrieve(url, filename)
1 个解决方案
#1
17
filename is basically your reference to the file and where it is stored. Using the following command
filename基本上是对文件的引用及其存储位置。使用以下命令
fullfilename = os.path.join(myPath, filename)
urllib.urlretrieve(url, fullfilename)
You should be able to store it at myPath.
您应该能够将其存储在myPath中。
Don't forget to place
别忘了放置
import os
at the top of your script..
在脚本的顶部..
#1
17
filename is basically your reference to the file and where it is stored. Using the following command
filename基本上是对文件的引用及其存储位置。使用以下命令
fullfilename = os.path.join(myPath, filename)
urllib.urlretrieve(url, fullfilename)
You should be able to store it at myPath.
您应该能够将其存储在myPath中。
Don't forget to place
别忘了放置
import os
at the top of your script..
在脚本的顶部..