A = os.path.join(os.path.dirname(__file__), '..')
B = os.path.dirname(os.path.realpath(__file__))
C = os.path.abspath(os.path.dirname(__file__))
Run Code Online (Sandbox Code Playgroud)
我通常只是用实际路径来硬连线.但是这些语句在运行时确定路径是有原因的,我真的很想了解os.path模块,所以我可以开始使用它.
python ×1