반응형
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
- matplotlib
- SQL
- gas
- PANDAS
- Kotlin
- Mac
- numpy
- PostgreSQL
- Apache
- hive
- dataframe
- Redshift
- string
- math
- PySpark
- 파이썬
- Excel
- Python
- list
- Google Excel
- Java
- Github
- Tkinter
- Google Spreadsheet
- google apps script
- c#
- django
- array
- GIT
Archives
- Today
- Total
달나라 노트
Python time : sleep (Python 코드 작동 일시정지) 본문
728x90
반응형
Python time 모듈의 sleep method는 Python 코드의 실행을 몇 초 동안 일시정지하는 기능을 가집니다.
import time
time.sleep(second)
사용법은 간단합니다.
sleep method에 sleep할 초를 적어주면 됩니다.
import time
import datetime
dttm_now = datetime.datetime.now()
print(dttm_now)
time.sleep(20)
dttm_now = datetime.datetime.now()
print(dttm_now)
-- Result
2022-02-22 00:03:49.997681
2022-02-22 00:04:09.999083
위 코드는 약 20초간 sleep하는 코드입니다.
처음에 print되는 현재 시간과 두번째 print되는 시간의 차리를 보면 20초인 것을 확인할 수 있습니다.
728x90
반응형