Python calendar 模块,month() 实例源码

我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用calendar.month()

项目:uband-python-s1-july    作者:guoylyy    | 项目源码 | 文件源码
def main():

    import time
    ticks=time.time()
    print ' ???????',ticks   
    print '---------'
    localtime=time.localtime(time.time())
    print ' ??????',localtime  
    print '---------'
    localtime=time.asctime(time.localtime(time.time()))
    print '??????',localtime
    print '---------'
    print time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) 
    print time.strftime("%a %b %d %H:%M:%S %Y", time.localtime())
    a=time.strftime("%a %b %d %H:%M:%S %Y", time.localtime())
    print time.mktime(time.strptime(a,"%a %b %d %H:%M:%S %Y"))
    print '---------'


    import calendar
    cal=calendar.month(2017,7)
    print cal
项目:python-Uband    作者:sy-yunyi    | 项目源码 | 文件源码
def main():
    ticks=time.time()
    print ' ??????? ',ticks

    localtime = time.localtime(ticks)
    print "????? :", localtime

    localtime1 = time.asctime(localtime)
    print "????? :", localtime1

    print time.strftime("%Y-%m-%d %H:%M:%S",localtime) 
    print time.strftime("%a %b %d %H:%M:%S %Y",localtime) 

    a = "Sat Mar 28 22:24:24 2016"
    print time.mktime(time.strptime(a,"%a %b %d %H:%M:%S %Y"))

    cal = calendar.month(2017, 5)
    print "????2017?5?????:"
    print cal;
项目:uband-python-s1-july    作者:guoylyy    | 项目源码 | 文件源码
def main2():
#time
    #??time.time()?????????,?????????1970-2038
    import time;
    ticks = time.time()
    print '??????:',ticks
#??????????????9???????
#???????????????????????????localtime
    print'----------------------'
    import time
    localtime = time.localtime(time.time())
    print '?????:',localtime
# ?????????asctime()
    print '--------------------'
    import time
    localtime = time.asctime(time.localtime(time.time()))
    print '?????:',localtime
#??????time-strftime
    print'-----------------------'
    import time
    #????2017-07-25 21:14:19??
    print time.strftime('%Y-%m-%d %H:%M:%S',time.localtime())
    #????Tue Jul 25 21:14:19 2017??
    print time.strftime('%a %b %d %H:%M:%S %Y',time.localtime())
    #????????????
    a = 'Tue Jul 25 21:08:49 2017'
    print time.mktime(time.strptime(a,'%a %b %d %H:%M:%S %Y'))
#calendar???????
    import calendar
    cal = calendar.month(2017,7)
    print '????2017?7?????:'
    print cal;
项目:Beginners-Python-Examples    作者:AsciiKay    | 项目源码 | 文件源码
def viewCalender():
    yy = int(input('Year : '))
    mm = int(input('Month : '))
    view = calendar.month(yy , mm)
    print('\n' + view)

# main user interaction code
项目:BAPythonDemo    作者:boai    | 项目源码 | 文件源码
def ba_getCurrentCalendarWithMonth(year, month):
    currentCalendar = calendar.month(year, month)
    print('????%s?%s?????\n%s \n'%(year, month, currentCalendar))
    return currentCalendar

# currentCalendar = ba_getCurrentCalendarWithMonth(2017, 10)
# print(currentCalendar)

# ????????-??
项目:matplotlib    作者:DaveL17    | 项目源码 | 文件源码
def chartSimpleCalendar(self, dev, p_dict, k_dict, return_queue):
        """"""

        log = {'Threaddebug': [], 'Debug': [], 'Info': [], 'Warning': [], 'Critical': []}
        try:
            if self.verboseLogging:
                log['Debug'].append(u"{0:<19}{1}".format("p_dict: ", [(k, v) for (k, v) in sorted(p_dict.items())]))
                log['Debug'].append(u"{0:<19}{1}".format("k_dict: ", [(k, v) for (k, v) in sorted(k_dict.items())]))

            import calendar
            today = dt.datetime.today()
            calendar.setfirstweekday(int(dev.pluginProps['firstDayOfWeek']))
            cal = calendar.month(today.year, today.month)

            ax = self.chartMakeFigure(350, 250, p_dict)

            ax.text(0, 1, cal, transform=ax.transAxes, color=p_dict['fontColor'], fontname='Andale Mono', fontsize=dev.pluginProps['fontSize'], backgroundcolor=p_dict['faceColor'],
                    bbox=dict(pad=3), **k_dict['k_calendar'])
            ax.axes.get_xaxis().set_visible(False)
            ax.axes.get_yaxis().set_visible(False)
            ax.axis('off')  # uncomment this line to hide the box

            if p_dict['fileName'] != '':
                plt.savefig(u'{0}{1}'.format(p_dict['chartPath'], p_dict['fileName']), **k_dict['k_plot_fig'])

            plt.clf()
            plt.close('all')

            return_queue.put({'Error': False, 'Log': log, 'Message': 'updated successfully.', 'Name': dev.name})

        except UnicodeEncodeError as sub_error:
            return_queue.put({'Error': True, 'Log': log, 'Message': sub_error, 'Name': dev.name})
        except Exception as sub_error:
            return_queue.put({'Error': True, 'Log': log, 'Message': sub_error, 'Name': dev.name})