python - 在 python 中,如何获取 "."的完整路径名?

标签 python directory os.path

我试过:

dir = os.path.dirname(".")

并且返回是空的。

最佳答案

abspath应该做的伎俩:

dir = os.path.abspath('.')

关于python - 在 python 中,如何获取 "."的完整路径名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47488276/

相关文章:

arrays - 用于检查文件列表中的所有文件是否存在于给定文件夹中的 Powershell 脚本

python - 在前导斜线之前不丢弃的 os.path.join() ?

python os.path.getmtime() 时间不变

Python docx 属性错误 : 'WindowsPath' object has no attribute 'seek'

bash - 如何从当前工作目录的另一个目录启动fzf?

android:确定符号链接(symbolic link)

python - 如何使用 os.walk() 在 Python 中处理 OSX 别名?

python - 更改 theano 矩阵中元素值的子集

python - 如何使 cookies 字典与 session.cookies 兼容

python - 在嵌套列表中搜索