Answer the question
In order to leave comments, you need to log in
How to specify the path to download a file from a link?
And so hello, I have a code that allows you to download files from a link, but I would like to change it so that you can specify the path where to download this file. How to implement it correctly?
def downloadin(path, link):
filename = link.split("/")[-1]
dfile = requests.get(link)
open(filename, "wb").write(dfile.content)
Answer the question
In order to leave comments, you need to log in
open( filename , "wb").write(dfile.content)
open( your_path + filename , "wb").write(dfile.content)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question