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
'Python' 카테고리의 다른 글
| [Python] 간단한 Tensorflow LSTM 예제 by ChatGPT (0) | 2023.06.01 | 
|---|---|
| [python] schedule 을 이용한 프로그램 시작 종료 (2) | 2023.05.19 | 
| [python] Numpy 를 이용한 1~10까지 더하기 : 누적합(Cumulative Sum) (0) | 2021.11.10 | 
| [Python] 함수 만들기 (0) | 2021.11.03 | 
| [Python] Matplotlib 예제 (0) | 2021.11.03 | 
