I am new to Python. I am trying to input one path and use os.walk()
to search all files, and return the files' names. I also want to use os.path.getsize()
to get file size, and finally, write them into a csv file.
However, if the file name is not in English, but in Chinese, German, French, etc, Python cannot recognize it and does not return the size of the file. I'd like to use os.path.getsize(path)
(referring to the example below), but it does not recognize the file's name. How can I let Python recognize the file's name and return the size of these kind of files?
For example: the file's name is: "Показатели естественного и миграционного прироста до 2030г.doc"
. path="C:\xxxx\xxx\xxxx\Показатели естественного и миграционного прироста до 2030г.doc"