You are given a task to parse string dates in various formats and convert them to datetime objects in Python. Which module would you use to achieve this?

  • calendar
  • datetime
  • dateutil
  • time

In Python, the datetime module provides classes for working with dates and times, making it the appropriate choice for parsing string dates into datetime objects. The time module deals with lower-level time-related operations, and the calendar module is used for calendar-related calculations. The dateutil module is a third-party library that enhances the capabilities of datetime.

Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *