import os
import shutil
#锁屏壁纸文件目录,根据自己电脑文件位置更改
source_path = os.path.abspath(r'C:\Users\DBJ\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets')
#存放导出壁纸文件目录,目录复制粘贴后要加上斜杠
target_path = 'D:\Desktop\文件夹\Assets/'
if not os.path.exists(target_path):
os.makedirs(target_path)
if os.path.exists(source_path):
for root, dirs, files in os.walk(source_path):
for file in files:
src_file = os.path.join(root, file)
#若更改导出文件格式,可将jpg更改为自己想要的格式
newtargetpath=target_path+file+'.jpg'
shutil.copyfile(src_file, newtargetpath)
print(src_file)
print('copy files finished!')
Python—获取电脑的锁屏壁纸
最新推荐文章于 2023-11-25 11:20:56 发布