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
- pip
- Docker
- C
- paramiko
- YOLO
- 채보
- JSON
- Visual Studio
- C++
- 핑거스타일
- pytorch
- windows forms
- Python
- 프로그래머스
- VS Code
- C#
- error
- mysql
- LIST
- Linux
- 컨테이너
- SSH
- pandas
- 오류
- label
- ubuntu
- Numpy
- Selenium
- 기타 연주
- OpenCV
Archives
- Today
- Total
기계는 거짓말하지 않는다
Python 특정 코드 실행 시간 시간:분:초 출력 본문
datetime 모듈의 timedelta 를 이용한다.
datetime — 기본 날짜와 시간 형 — Python 3.10.7 문서
datetime — 기본 날짜와 시간 형 소스 코드: Lib/datetime.py datetime 모듈은 날짜와 시간을 조작하는 클래스를 제공합니다. 날짜와 시간 산술이 지원되지만, 구현의 초점은 출력 포매팅과 조작을 위한
docs.python.org
from datetime import timedelta
import time
delta = timedelta(days=50, seconds=27, microseconds=10, milliseconds=4, minutes=5, hours=8, weeks=1)
print(delta)
start_time = time.time()
temp_list = []
for i in range(0, 100000001):
temp_list.append(i + 1)
total_time_str = str(timedelta(seconds=int(time.time() - start_time)))
print(total_time_str)
'Python' 카테고리의 다른 글
Python 리스트 내포(List Comprehension) (1) | 2022.09.19 |
---|---|
Python 경로 확장자, 파일 이름 분리 (0) | 2022.09.17 |
Python 날짜 문자열 변환 (0) | 2022.08.25 |
Python RLock 자원 동시 접근 관리 (0) | 2022.07.22 |
Python Error argument after * must be an iterable, not Queue (0) | 2022.06.10 |
Comments