Calendar module Calendar

#calendar
 import calendar #Get
 the calendar of the specified year
 res=calendar.calendar( 2018 , w = 5 , c = 5 )
 print (res)

#Get the calendar of the specified month
 res_month=calendar.month( 2018 , 4 , w = 3 )
 print (res_month)

#Determine whether the year is a leap year
 is_leap=calendar.isleap( 2012 )
 print (is_leap)

#Get the number of leap years between two years
 num=calendar.leapdays( 1990 , 2018 )
 print (num)

# will specify a nested list of month and week
 list_list=calendar.monthcalendar( 2018 , 4 )
n=[x for x in range(1,10) if x%2==0]
print(list_list)

#Get monthly information
 info=calendar.monthrange( 2018 , 4 )
 print (info)

#Set the specified date and return the corresponding week number
 week=calendar.weekday( 2018 , 4 , 20 )
 print (week)

count=10
while count>0:
    for i in range(100):
        count-=1
print(i)        

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324718891&siteId=291194637