Now that the basic layout is output, we can set up the calendar itself. A calendar, at its most basic point, is a table. So let's make a table in our HTML:
print '''
<table id="month" >
<thead >
<tr >
<th class="weekend" >Sunday</th >
<th >Monday</th >
<th >Tuesday</th >
<th >Wednesday</th >
<th >Thursday</th >
<th >Friday</th >
<th class="weekend" >Saturday</th >
</tr >
</thead >
<tbody >
'''
Now our program will print our desired header with the current month and year. If you have used the command-line option mentioned earlier, here you should insert an if-else statement as follows:
if firstday == '0': print '''
<table id="month" >
<thead >
<tr >
<th >Monday</th >
<th >Tuesday</th >
<th >Wednesday</th >
<th >Thursday</th >
<th >Friday</th >
<th class="weekend" >Saturday</th >
<th class="weekend" >Sunday</th >
</tr >
</thead >
<tbody >
'''
else: ## Here we assume a binary switch, a decision between '0' or not '0'; therefore, any non-zero argument will cause the calendar to start on Sunday.
print '''
<table id="month" >
<thead >
<tr >
<th class="weekend" >Sunday</th >
<th >Monday</th >
<th >Tuesday</th >
<th >Wednesday</th >
<th >Thursday</th >
<th >Friday</th >
<th class="weekend" >Saturday</th >
</tr >
</thead >
<tbody >
'''
