[python rookie] ask questions about with open save path customization

The

code is as follows:

from bs4 import BeautifulSoup
import requests

movie_total = list()

url = "https://movie.douban.com/top250"

for i in range(10):
    web_url = {
        "start" : i*25 ,
        "filter" : 0
    }

    res = requests.get(url , params=web_url)

    bsObj = BeautifulSoup(res.text , "html.parser")

    div_item_list = bsObj.find_all("div",{"class":"item"})

    for div_item_temp in div_item_list:
        movie_temp = dict()
        movie_temp["name"] = div_item_temp.find_all("div")[1].div.a.span.get_text()
        movie_temp["score"] = div_item_temp.find("div",{"class":"star"}).find_all("span")[1].get_text()
        movie_temp["number"] = div_item_temp.find("div",{"class":"star"}).find_all("span")[-1].get_text()[:-3]
        try:
            movie_temp["introduction"] = div_item_temp.find_all("div")[1].find("p",{"class","quote"}).span.get_text()
        except:
            movie_temp["introduction"] = "------"
        movie_temp["img"] = div_item_temp.div.a.img["src"]
        pic_url = requests.get(movie_temp["img"])
        with open(movie_temp["name"]+".jpg","wb") as pic_file:
            pic_file.write(pic_url.content)

        movie_total.append(movie_temp)


print(movie_total)
print(len(movie_total))

for movie_one in movie_total:
    print(":%s\t:%s\n:%s\t:%s\n:%s"%(movie_one["name"] ,movie_one["score"],movie_one["number"],movie_one["introduction"],movie_one["img"]))

the whole code has been tested without a problem
the problem lies in the paragraph shown in the figure:

clipboard.png
macbookPromac:
:

clipboard.png

I would like to ask, how can I set up so that the pictures can be saved in my own custom folder?
for example, I want to save it in a folder above my desktop under abc. What should I do here?

Mar.03,2021

I found the answer myself, refer to https://www.cnblogs.com/wangy.


The path to the desktop of

MAC is generally ~ / Desktop

.

so if you want to save a folder above your desktop under abc, you can open ('~ / Desktop/abc', 'wb')

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf38f1-31e90.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf38f1-31e90.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?