Legacy – Creating Text Calendar Workout
- 01:53
Workout demonstrating how to create a text calendar in Python.
Glossary
Calendar Library Text CalendarsTranscript
We'll look at some examples of working with calendars and in Python. Before we start anything, we got to import the calendars. Now, why do we use calendars, because in case we want a date or certain day from some time in the future, we can easily create a programme that will enable us to give specific dates in return. And it's really quick as well. So that's the reason we use the calendar module in Python. So firstly, if we want to create a plain text calendar, how do we do that? So firstly, let us say, calendar. Count for calendar equals Calendar . txt calendar. And we want the calendar to start on a Sunday meaning the Sunday would be the first weekday in the calendar. And then we can say that the actual calendar that will be printed on the Python would be calc . format month. So we will in case we want the 2020 calendar for March and the last two are zero meaning the horizontal and the vertical spacing is fine. There isn't any extra spacing. And if we run this no errors are returned. So let's see how our calendar would look like so let's say print calendar.
Let's run this as a perfect this is our calendar look like March 2020, starting on Sunday and no additional spacing. So in case if we set this as two and this so let's see what will happen. The only change will be there'll be space in between the horizontal and vertical values in the calendar.