■ PosixPath 클래스의 absolute 메소드를 사용해 절대 경로를 구하는 방법을 보여준다.
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import pathlib posixPath = pathlib.Path("source") / "test" / "code" / "text.py" print("상대 경로 :", posixPath ) print("절대 경로 :", posixPath.absolute()) """ 상대 경로 : source/test/code/text.py 절대 경로 : /home/king/testproject/source/test/code/text.py """ |