본문 바로가기

PYTHON

현재시간 출력

728x90

import datetime  

now = [datetime.datetime.now()](datetime.datetime.now())  

print([now.year)](now.year))  
print([now.month)](now.month))  
print([now.day)](now.day))  
print([now.hour)](now.hour))  
print([now.minute)](now.minute))  
print([now.second)](now.second))  

print("지금 시각은 {}년 {}월 {}일 {}시 {}분 {}초입니다.".format([now.year,](now.year,) [now.month,](now.month,) [now.day,](now.day,) [now.hour,](now.hour,) [now.minute,](now.minute,) [now.second))](now.second)))

'PYTHON' 카테고리의 다른 글

pyperclip 복사 붙여넣기  (0) 2019.11.12