Revision b268f797-b4ae-4760-8948-dca39fbcb71b - Code Golf Stack Exchange
**Python 2.7 - 152**
Unfortunately it fails for [September 1752][1]. Granted, it imports all of the calender functions, but only *uses* 1, and that just returns the start day of the week and the number of days.
from calendar import*
w,l=monthrange(*divmod(input(),100))
print" Mo Tu We Th Fr Sa Su\n"+" "*w+''.join(["%3d"%s+"\n"*((s+w)%7<1)for s in range(1,l+1)])
Test output:
> 198210
Mo Tu We Th Fr Sa Su
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30
[1]: http://en.wikipedia.org/wiki/Calendar_%28New_Style%29_Act_1750