Getting short path in python

前端 未结 2 663
孤街浪徒
孤街浪徒 2021-01-19 06:51

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 =          


        
2条回答
  •  隐瞒了意图╮
    2021-01-19 07:23

    import win32api
    long_file_name='C:\Program Files\I am a file'
    short_file_name=win32api.GetShortPathName(long_file_name)
    

提交回复
热议问题