簡體   English   中英

OSError: [WinError 123] 文件名、目錄名或卷 label 語法不正確:

[英]OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect:

嗨,我需要找到重命名 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" )

文件的名稱應該是文件名,文件的舊名稱是文件我這樣做是因為我可以將它放入循環中

Windows 不允許您使用 pipe 字符"|" 在文件名或路徑中。

也許嘗試:

filename = word +"~"+ word1 + "~" + "#Shorts"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM