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 |
29 | 30 |
Tags
- 조현병
- 최성재
- 봉준호감독통역
- 코로나
- everybody wants you
- 우한코로나바이러스
- 창궐
- Bolton
- 중국외교부
- 우한코로나
- 신종코로나
- 봉준호감독통역사
- 진짜영웅
- 우한
- 코로나바이러스
- 치앙마이
- 필리핀사망
- 확진자수
- 코로나19
- 웨일즈
- 전염병
- 미중
- red hearse
- 우한 코로나
- sharonchoi
- 정은경 본부장님
- 어서와한국은처음이지
- cnn
- wuhan
- parasite
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
'개발노트 > 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