[Python] strftime & strptime 비교 정리
날짜 및 시간은 표현 방법이 매우 다양하고, 입력 형식에 따라 string, numeric, datetime 과 같은 타입을 가질 수 있다. 이와 같은 날짜형 데이터를 원하는 형태로 변경하기 위해서 꼭 알아야할 메서드로 strftime 과 strptime 이 있다. 두 메서드의 차이를 이해하기 위해 이름의 의미와 역할에 대해 정리해보았다. 1. 요약 이름 (f/p) 역할 strftime f (format) datetime → string strptime p (parse) string → datetime 2. strftime strftime 은 날짜형 객체를 주어진 포맷의 문자열로 변환한다. (예시) from datetime import datetime dt = datetime(2022,5,1,12,30,..
2022.05.25