python替换文件名

个人博客,欢迎来撩 fangzengye.com



import os
import random
import time
while True:
num = str(random.randint(0,20))
imageID = '852bf6fcb551998f68b1bf87ad090b77.jpg'
path = 'E:\wallpapercache\img\'
os.rename(path + num + '.jpg', path + imageID)
time.sleep(66)
os.rename(path + imageID, path +num + '.jpg')

posted @ 2020-11-06 11:38  开源的Boy  阅读(129)  评论(0)    收藏  举报