Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 봉준호감독통역
- Bolton
- wuhan
- 우한코로나
- 최성재
- 치앙마이
- 코로나19
- 미중
- 봉준호감독통역사
- 우한
- 우한코로나바이러스
- 코로나바이러스
- 우한 코로나
- 확진자수
- 중국외교부
- 필리핀사망
- 정은경 본부장님
- 창궐
- 코로나
- 조현병
- cnn
- 웨일즈
- 신종코로나
- 어서와한국은처음이지
- 전염병
- 진짜영웅
- red hearse
- parasite
- everybody wants you
- sharonchoi
Archives
- Today
- Total
오지's blog
해당 폴더가 존재하지 않으면 폴더 생성 python 본문
728x90
반응형
그대로 코드로 옮긴다.
만약 생성하고자 하는 폴더가 해당 path에 없으면,
해당 path에 폴더를 생성한다.
if not os.path.exists(os.path.join(os.getcwd(), "downloads"))
만약 생성하고자 하는 폴더가 해당 path에 없으면,
해당 path에 폴더를 생성한다.
os.makedirs(os.path.join(os.getcwd(), "downloads"))
def set_downloads_folder():
downloads_folder = os.path.join(os.getcwd(), "downloads")
if not os.path.exists(downloads_folder):
os.makedirs(downloads_folder)
return downloads_folder
References
https://www.tutorialspoint.com/How-can-I-create-a-directory-if-it-does-not-exist-using-Python
How can I create a directory if it does not exist using Python?
www.tutorialspoint.com
'개발노트 > Python' 카테고리의 다른 글
db의 table에서 csv로 변환시 한글깨짐 현상 (0) | 2022.03.17 |
---|---|
selenium으로 크롤링시 다운로드시 특정 파일에 넣기 (0) | 2022.03.08 |
RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods 해결 방안 (0) | 2022.02.20 |
airflow slack fail메세지에서 log url변경하는 방법 (0) | 2022.01.24 |
큰 dataframe을 out of memory 에러 없이 로딩하는 방법 (0) | 2022.01.18 |
Comments