xiaoing.com©

开花即结果 提问即答案

用Python写个柯南的壁纸图片源代码
原始问题:

用Python写个柯南的壁纸图片源代码

# import required libraries 
import urllib.request 
import os 
  
# download images from the web 
def dwnld_img(url, file_name): 
    full_path = file_name + '.jpg'   # create a new path for the image to be downloaded as 
    urllib.request.urlretrieve(url, full_path) # download and save the image at the given path  

  
# main function that downloads Conan wallpapers from internet 

 def main(): 

    # Conan Wallpaper Urls list  

    conan_wallpaper = ['https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/9d7e1b0e-d7f3-4ec5-b818-f2530db6fb1a/d9i2sjg-8560cd81-3ab6-4b99-841e-ce45dd0fe2cc.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcLzlkN2UxYjBlLWQ3ZjMtNGVjNS1iODE4LWYyNTMwZGI2ZmIxYVwvZDlpMnNqZy04NTYwY2Q4MS0zYWI2LTRiOS05ODQxLWNlNDVkZDBmZTJjYy5qcGciLCJwdWJsaWNfaGFzaCI6ImFhOWRkOGE3MDU3ODBhOTViNDhmMTdiMTdjMWRlMDFlOWEifV1dLCJhdWQiOlsidXJuOnNlcnZpY2U6aW1hZ2Uub3BlcmF0aW9ucyJdfQ.C8SOhKrPrHEmKPvErpEWoMeTnEdEuPKCn7CvAqRmspo', 'https://images6.alphacoders.com/102/thumb1920/102238.png', 'https://www.itl.cat/pngfile/big/91-916052_detectiveconanwallpaperiphonecaseclosedwallpaperiphoneforandroidconanedogawaandranmoriyawallpapersdesktopbackgrounds1920x1280pxjpgconanedogawaiphonewallpapersfreeforphonebackgrounds'] 

    # create a directory to store all wallpapers if it does not exist already     

    if not os.path.exists('ConanWallpapers'):     # check if directory exists or not  

        os .mkdir('ConanWallpapers')              # make a directory named ConanWallapapers to store images in it    

        print("Directory Created!")               # print this message after creating directory successfully      

          
        for i, wallpaper in enumerate(conan_wallpaper):      # loop through all the links one by one and download them using dwnldimg() function     

            print("Downloading Image: {}".format(str(i+1)))     # print this message while downloading each image      

            dwnld_img(wallpaper, 'ConanWallpapers\image'+str(int(time())))     # call dwnldimg() function here with given parameters     
用Python写个柯南的壁纸图片源代码
https://www.xiaoing.com/zhidao/13199.html
AI / 模型DeepSeek
时间 / DATEApril 18, 2023, 3:59 PM
语言zh-CN
IP / 区域 江苏 苏州