【发布时间】:2022-01-16 13:49:27
【问题描述】:
您好,我需要找到重命名 mp4 文件的解决方案:
list_of_choice = ("satisfying","satisfying video","the most satisfying","most oddly satisfying","satisfying videos","the most satisfying video in the world","oddly satisfying videos","sand and slime","ASMR vertical","best oddly satisfying","best oddly satisfying video","satisfying video for sleep","oddly satisfying video to help you sleep","stress relief","satisfaction","no music satisfying","slime","satisfying video to make you sleep","original resource","funny videos")
word = random.choice(list_of_choice)
list_of_choice = ("satisfying","satisfying video","the most satisfying","most oddly satisfying","satisfying videos","the most satisfying video in the world","oddly satisfying videos","sand and slime","ASMR vertical","best oddly satisfying","best oddly satisfying video","satisfying video for sleep","oddly satisfying video to help you sleep","stress relief","satisfaction","no music satisfying","slime","satisfying video to make you sleep","original resource","funny videos")
word1 = random.choice(list_of_choice)
filename = word +"~"+ word1 + "~" + "#Shorts"
file = "output" + f"{number:03}" + ".mp4"
os.rename(file, filename +".mp4" )
文件名应该是文件名,文件的旧名是文件我这样做是因为我可以把它放到循环中
错误:
OSError: Windows can not read a string
【问题讨论】:
-
请填写预期的文件名
标签: python windows error-handling