datetime2 Pydantic 의 Datetime 타입으로 날짜와 시간을 다뤄보자 Pydantic 의 네 가지 Datetime 타입 Pydantic은 데이터 유효성 검사와 데이터 클래스 설정을 간결하게 만들어주는 Python 라이브러리다. Pydantic에서는 날짜와 시간을 다루는 특별한 타입이 있는데, AwareDatetime, NaiveDatetime, PastDatetime, FutureDatetime이 바로 그것이다. 이 글을 통해 각각의 타입이 어떻게 동작하고 언제 사용되는지 확인해보자. AwareDatetime AwareDatetime은 시간대(timezone) 정보가 포함된 datetime 객체를 의미한다. 세계 각지의 시간대를 일관성 있게 처리해야 할 때 유용하게 쓸 수 있다. 사용 예시 from pydantic import BaseModel from datetime i.. 2023. 8. 21. 0906. The Coupon Code Story Your online store likes to give out coupons for special occasions. Some customers try to cheat the system by entering invalid codes or using expired coupons. Task Your mission: Write a function called checkCoupon which verifies that a coupon code is valid and not expired. A coupon is no more valid on the day AFTER the expiration date. All dates will be passed as strings in this format: "MO.. 2022. 9. 6. 이전 1 다음