1. 学习
  2. /
  3. 课程
  4. /
  5. Python으로 하는 Financial Forecasting

Connected

练习

datetime 라이브러리 다루기

이번에는 datetime 라이브러리, 특히 문자열 날짜를 일/월/년 형식에 맞춰 변환하는 datetime.strptime(date_string, format) 메서드를 살펴봅니다. 아래 표를 참고해 날짜에서 연, 월, 일을 올바르게 식별할 수 있는 코드를 작성해 보세요(콘솔에서 메서드를 출력해 정답을 확인할 수 있어요):

  • 12-01-1990 (미국 형식 m-d-y)
  • 23/08/2020 (유럽 형식 d-m-y)
Directive Meaning Example
%d Day of the month as a zero-padded decimal number 01, 02, …, 31
%b Month as locale’s abbreviated name Jan, Feb, …, Dec
%B Month as locale’s full name January, …, December
%m Month as a zero-padded decimal number 01, 02, …, 12
%y Year without century as a zero-padded decimal number 00, 01, …, 99
%Y Year with century as a decimal number 1970, 1988, 2001, 2013

说明

50 XP

答案选项