Obtain File size with os.path.getsize() in Python 2.7.5

Posted by Ruxuan Ouyang on Stack Overflow See other posts from Stack Overflow or by Ruxuan Ouyang
Published on 2013-07-01T17:53:03Z Indexed on 2013/07/02 23:06 UTC
Read the original article Hit count: 180

Filed under:
|
|

I am new to python. I am trying to use os.path.getsize() to obtain the file size. However, if the file name is not in Englist, but in Chinese, Gemany, or French, etc, Python cannot recognize it and do not return the size of the file. Could you please help me with it? 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"

I'd like to use" os.path.getsize(path)

But it does not recognize the file name. Could you please kindly tell me what should I do?

Thank you very much!

© Stack Overflow or respective owner

Related posts about python

Related posts about unicode