python 3超簡単コードはデスクトップの壁紙を登ります。

871 ワード

私達が登りたいのは彼岸の壁紙です。http://www.netbian.com/コードを付けます。
 
for j in range(100, 120):#       100   120  
    url = "http://www.netbian.com/desk/20" + str(j) + "-1920x1080.htm"
    response = requests.get(url)
    root = etree.HTML(response.content)
    src_list = root.xpath("//div[@id='main']/table[@id='endimg']/tr/td/a/img/@src")
    print(src_list)
    path = 'E:\\666666'
    os.makedirs(path)  #   666666             ,   666666           
    os.chdir(path + '\\')
    os.chdir(path)
    response = requests.get(src_list[0])
    f = open(str(j) + ".jpg", "wb")  # random.randint(0, 9)
    f.write(response.content)
    f.close()
欠点は特定の分類の壁紙を登らないことです。すべてランダムな壁紙です。特定の分類の壁紙を登らなければなりません。例えば、美人類、アイデア類、自動車類の壁紙をダウンロードしてください。
https://download.csdn.net/download/dlpdsq/10568727