I have a file name "abc 枚 .xlsx" containing a non-ASCII character encoding, and I would like to delete all characters without ASCII characters to rename them to "abc.xlsx".
Here is what I tried:
import os import string os.chdir(src_dir)
The following error occurs when os.rename() :
builtins.WindowsError: (2, 'The system cannot find the file specified')
This is on a windows system, sys.getfilesystemencoding() gives me mbcs if that helps anyone.
What should I do to get around this error and let me change the file name?
source share