write a one year calendar to file using python -
when run below code prints out calendar entire year (which don't want). want write file won't. returns error message typeerror: expected character buffer object. also, casting string doesn't work.
import calendar cal = calendar.prcal(2015) open('yr2015.txt', 'w') wf: wf.write(cal) as example, below code prints 1 month of year , returns string, isn't want
print calendar.month(2015, 4) print type(calendar.month(2015, 4)) so when run below code error message <type 'nonetype'>. seems me should string isn't. suggestions on how can 12-month calendar text file?
print type(calendar.prcal(2015))
prcal doesn't return anything. use cal = calendar.textcalendar().formatyear(2015) instead.
Comments
Post a Comment