我試圖重新命名這種模式命名的文件夾名稱:FOLDERNAME(###)Python的 - 使用str.replace使用通配符
我試圖擺脫(###),一一系列隨機長度的數字。
我想用str.replace作爲展示如下做到這一點,但我不知道我可以使用通配符這樣...
folderdir = os.listdir(path) # Listing the folder names
for foldername in folderdir:
output = foldername.replace("(*)", "")
rename()
打算用其他的解決方案,但是這是清潔劑(和它的作品太)。謝謝! – baldurmen