How do you loop through an entire year showing each day's date?
Ene Uran
638
Posting Virtuoso
Recommended Answers
Jump to PostYou are dealing with date objects so it is best to use module datetime ...
import datetime # pick a year year = 2006 # create date objects begin_year = datetime.date(year, 1, 1) end_year = datetime.date(year, 12, 31) one_day = datetime.timedelta(days=1) print "These are all the dates …
Jump to PostHi Ene, looks like you are working on Friday the 13th project. It took me a while, but I solved it. I can give you a hint, replace the line
print next_day
with this expanded line
print next_day, "day of week =", next_day.weekday()
The …
All 5 Replies
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
Ene Uran
638
Posting Virtuoso
bumsfeld
413
Nearly a Posting Virtuoso
Ene Uran
638
Posting Virtuoso
bumsfeld
413
Nearly a Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.