Python - WindowsError: [Error 2] The system cannot find the file specified

前端 未结 4 1656
梦毁少年i
梦毁少年i 2020-12-21 19:49

I have a folder full of pdf files. I\'m trying to remove all the spaces from files name and replace them with underscores. Here\'s what I have so far:

import         


        
4条回答
  •  Happy的楠姐
    2020-12-21 19:56

    You renaming files in current directory but reading in the folder. You need to add to os.rename the folder path or at the beginning os.chdir(folder) and then just use os.listdir() and os.rename

提交回复
热议问题