| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 31 |
Tags
- 미국 증시 방향성
- 스코어카드 예시
- 25년 3월 증시 분석
- 관세 설명
- jupyter notebook PDF
- 2025년도 미국 관세
- 스코어카드 만드는법
- Python Numpy
- 딥러닝
- 취업사이트 정리
- 트럼프 2025년 미국 관세
- 2025년 3월 6일 미국 증시 분석
- 25년 3월 12일 미국 증시 분석
- 연체 css
- 주식 데이터 수집
- 딥러닝 제대로 시작하기
- 미국 투자 분석
- 25년 3월 11일 미국 증시 분석
- 미장 분석
- 25년 3월 미국 증시 분석
- css 리스크
- 미국 증시 분석
- 코딩 사이트 정리
- 미국 시황
- css risk
- 트럼프 미국 관세
- css 리스크관리
- python pandas
- 연체용어
- Cudnn 버전 확인
Archives
- Today
- Total
koos808
파이썬 폴더 없으면 생성하기, 코드 시작 시간으로 폴더 생성하기 os.path.exists(), time.localtime() 본문
Python
파이썬 폴더 없으면 생성하기, 코드 시작 시간으로 폴더 생성하기 os.path.exists(), time.localtime()
koos808 2021. 4. 11. 21:59728x90
반응형
# 폴더 없으면 생성하기
1. 기본 코드
import os
if not os.path.exists(model_object_file_path):
os.makedirs(model_object_file_path)
2. 응용 : 추가로 weight와 output path 시간단위로 폴더만들어서 저장하기
# weight, output images path 설정 및 folder 생성
import os
import time
output_save_folder_path = os.getcwd() + '/detect_output/'
output_path = os.path.join(output_save_folder_path, time.strftime('%Y%m%d_%H_%M', time.localtime(time.time())))
weight_save_folder_path = os.getcwd() + '/detect_weights/'
weight_path = os.path.join(weight_save_folder_path, time.strftime('%Y%m%d_%H_%M', time.localtime(time.time())))
if not os.path.exists(output_save_folder_path):
os.mkdir(output_save_folder_path)
if not os.path.exists(output_path):
os.mkdir(output_path)
if not os.path.exists(weight_save_folder_path):
os.mkdir(weight_save_folder_path)
if not os.path.exists(weight_path):
os.mkdir(weight_path)
728x90
반응형
'Python' 카테고리의 다른 글
| 주피터노트북 아나콘다 프롬프트, 리눅스 가상환경 관련 코드(간단) (0) | 2021.04.11 |
|---|---|
| 주피터노트북에서 파이썬 버전확인하는 방법 (0) | 2021.04.11 |
| 파이썬 pandas to_csv 함수로 csv 파일 저장 시 한글깨짐 해결방법 및 파일 저장 코드 (0) | 2021.04.11 |
| Python 크롤링 셀레니움(Selenium)으로 화면 스크린샷(Screenshot)하기 (0) | 2021.04.11 |
| Python 리스트에서 확장자 제거하는 여러가지 방법 (0) | 2021.02.05 |
Comments