[Python] 현재 날짜 가져오기
파이썬에서 현재 날짜 가져오기.. 자주 쓰는 기능인데 항상 까먹는다..이 기회에 외우자. from datetime import datetime datetime.today() # 현재 날짜 가져오기 datetime.today().year # 현재 연도 가져오기datetime.today().month # 현재 월 가져오기datetime.today().day # 현재 일 가져오기datetime.today().hour # 현재 시간 가져오기 위와 같이 데이터를 가져오는 경우가 있고, 나같은 경우에는 내가 원하는 포멧으로 출력을 원하기 때문에 아래와 같이 strftime() 함수를 이용한다. datetime.today().strftime("%Y%m%d%H%M%S") # YYYYmmddHHMMSS 형태의 시간 출력..
2015.02.08