Python
[Python] time datetime 을 이용한 시간(datetime) 출력
비니미니파파
2023. 4. 4. 14:47
import time
from datetime import datetime
while True:
# 현재 시간 출력 YYYY-MM-DD HH:MI:SS
s = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
print(s)
# 1초간 sleep
time.sleep(1)
python 시간 포맷을 알아보려면 아래 사이트를 방문 하자!
https://docs.python.org/3/library/datetime.html
datetime — Basic date and time types
Source code: Lib/datetime.py The datetime module supplies classes for manipulating dates and times. While date and time arithmetic is supported, the focus of the implementation is on efficient attr...
docs.python.org