카테고리 없음

[Python] 현재 디렉토리 내 파일 리스트 출력

얼레벌레또뇽 2023. 8. 1. 11:08
import os
print(os.listdir(os.getcwd()))

<출력결과>

['201801.csv', '202201.csv', '202207.csv', '202208.csv', '202306.csv', 'data process.py', 'lstm example.py', 'seoul water level info.xlsx', 'seoul water level.csv']

일치하는것을 볼 수 있다.

 

 

 

[참고]

https://codechacha.com/ko/python-examples-get-working-directory/

 

Python - 현재 디렉토리 위치(Working Directory) 얻는 방법

파이썬에서 파일의 위치 및 현재 디렉토리 위치를 구하는 방법들을 정리하였습니다. realpath, abspath, getcwd, getcwd 등 파이썬에서 기본적으로 제공하는 함수들을 이용하였습니다. 예제와 함께 파일

codechacha.com