OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Requests, how to download to a specific folder

  • Thread starter Thread starter user25653727
  • Start date Start date
U

user25653727

Guest
i tried to save a picture with requests in a specific folder

So i got a code like this

Code:
urldwl = ""
filename = ""
def downloadimg():
    img_data = requests.get(urldwl).content
    with open(filename + '.jpg', 'wb') as handler:
        handler.write(img_data)

the "urldwl" and "filename" is definied after in the code, so the code in this form work perfetcly, i need to someone that can find me a way to save the file to a specific folder

thank
<p>i tried to save a picture with requests in a specific folder</p>
<p>So i got a code like this</p>
<pre><code>urldwl = ""
filename = ""
def downloadimg():
img_data = requests.get(urldwl).content
with open(filename + '.jpg', 'wb') as handler:
handler.write(img_data)
</code></pre>
<p>the "urldwl" and "filename" is definied after in the code, so the code in this form work perfetcly, i need to someone that can find me a way to save the file to a specific folder</p>
<p>thank</p>
 

Latest posts

L
Replies
0
Views
1
lagnaoui jihane
L
E
Replies
0
Views
1
Eduard Dubilyer
E
Top