最佳答案
在多个开源项目中,我见过有人使用 os.path.abspath(os.path.realpath(__file__))来获取当前文件的绝对路径。
然而,我发现 os.path.abspath(__file__)和 os.path.realpath(__file__)产生相同的结果。 os.path.abspath(os.path.realpath(__file__))似乎有点多余。
人们用这个有什么原因吗?