You can use the datetime
module in Python to get the date for the first day of the current month. Here's the code:
main.py111 chars7 lines
This code creates a date
object for today's date (date.today()
), and then creates another date
object for the first day of the current month by passing today's year and month to the date()
constructor, along with a 1
for the day of the month. The resulting date
object is then printed to the console.
gistlibby LogSnag