相关疑难解决方法(0)

如何在python中获取Windows短文件名?

我需要从我的python代码中确定Windows短文件名.为此我可以使用win32api找到解决方案.

import win32api
long_file_name='C:\Program Files\I am a file'
short_file_name=win32api.GetShortPathName(long_file_name)
Run Code Online (Sandbox Code Playgroud)

参考:http://blog.lowkster.com/2008/10/spaces-in-directory-names-i-really-love.html

不幸的是,我需要安装pywin32ActivePython在我的情况下不可能.

也参考SO:

在python中获取短路径:在python中获取短路径

python python-2.7 python-3.x

10
推荐指数
1
解决办法
5785
查看次数

标签 统计

python ×1

python-2.7 ×1

python-3.x ×1