■ PosixPath 클래스의 glob 메소드를 사용해 자식 디렉토리 및 파일의 리스트를 구하는 방법을 보여준다.
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import pathlib posixPath = pathlib.Path('.') posixPathList = list(posixPath.glob('*')) print(posixPathList) """ [PosixPath('__pycache__'), PosixPath('storage'), PosixPath('env'), PosixPath('freeze.sh'), PosixPath('uninstall.sh'), PosixPath('requirements.txt'), PosixPath('main.py')] """ |