24. #python_024.py(시간 출력) |
|||||
---|---|---|---|---|---|
작성자 | 수안보중 | 등록일 | 19.11.13 | 조회수 | 38 |
#python_024.py(시간 출력) import time for t in range(10): print(time.ctime()) time.sleep(1) <결과> Wed May 15 19:48:20 2019 Wed May 15 19:48:21 2019 Wed May 15 19:48:22 2019 Wed May 15 19:48:23 2019 Wed May 15 19:48:24 2019 Wed May 15 19:48:25 2019 Wed May 15 19:48:26 2019 Wed May 15 19:48:27 2019 Wed May 15 19:48:28 2019 Wed May 15 19:48:29 2019 import datetime d = datetime.datetime.now() print(d) print(d.year, d.month, d.day, sep='/') print(d.hour, d.minute, d.second, d.microsecond, sep=':') print(d.weekday())
<결과> 2019-05-15 13:52:02.805643 2019/5/15 13:52:2:805643 2
|
이전글 | 25. python_025.py(파일 저장) |
---|---|
다음글 | 23. python_023.py(별모양 그리기) |