Getting short path in python
问题 How do I obtain the short path of a file in Windows using python ? I am using the following code , #!/usr/bin/python import os import sys fileList = [] rootdir = sys.argv[1] for root, subFolders, files in os.walk(rootdir): for file in files: fileList.append(os.path.join(root,file)) for File in fileList: print File 回答1: I guess you are looking for this: http://docs.activestate.com/activepython/2.5/pywin32/win32api__GetShortPathName_meth.html Although you will need the win32api module for this.