我需要通过在python 2.7中提供文件名来获取文件的完整路径。不幸的是,我不允许使用pathlib模块。
Example:
filename: python.exe
full path that i want to print : C:\app\tools\python27\python.exe
在此先感谢大家花点时间来回复。
查看以下主题的线程:How do I get the full path of the current file's directory?
我不确定您如何在代码中实现此功能,但是“ pathlib”(适用于v3以上版本)和“ os”(适用于v3以下版本)库应该可以提供帮助。
很抱歉,如果您已经查看了该主题并且没有找到答案!