get the date 5 days from now in python

You can use the datetime and timedelta modules in Python to get the date 5 days from now. Here's an example code snippet:

main.py
import datetime

today = datetime.date.today()
five_days_from_now = today + datetime.timedelta(days=5)

print(five_days_from_now)
130 chars
7 lines

This code first gets the current date using the today() function of the date class from the datetime module. Then it creates a timedelta object with 5 days using the timedelta() function and adds it to the current date to get the date that is 5 days from now. This value is then printed to the console.

gistlibby LogSnag