python - os.path.realpath() 返回一个以我家开头的字符串:
问题描述
os.path.realpath(__file__)
返回
/home/toto/file:/home/toto/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu37847ivic.tmp_/bal-L-1.1.4.oxt/python/rdt_bal.py
为什么它以 this 开头/home/toto/file:
而不是给出预期的 url,它是 ':' 之后的部分?
解决方案
os.path.realpath
将首先解析路径中的任何符号链接,然后返回绝对路径
推荐阅读
- database - Oracle 外部表
- python - 使用 Flask 时如何在 HTML 中使用和调用 python 函数?
- python - 如何删除数据框的索引或替换它?
- json-server - 无法从 json 服务器获取数据
- crystal-lang - Crystal lang:以跨平台方式连接路径?
- python - 当我使用 tensorflow ops 编写函数时会发生什么
- google-app-engine - Google Search API - 是否可以进行 IN 查询?
- java - 对在 android studio 中自定义 listview 感到困惑
- c++ - 为什么一个模板的模板参数列表和它的模板成员不能合并?
- c# - c# udp 检查消息是否到达