コード例 #1
0
def again():
    choice = input(
        "Do you want to continue? Please type Y for yes and N for no:")

    if choice.upper() == 'Y':
        calendar()

    elif choice.upper() == 'N':
        print("Bye! See you later!")

    else:
        again()
コード例 #2
0
 def select(self):
     file_name = self.file_name.get()
     if file_name == "academy.py":
         academy(self)
     if file_name == "basicCalc.py":
         basicCalc(self)
     if file_name == "click_counter.py":
         click_counter(self)
     if file_name == "calendar.py":
         calendar(self)
     if file_name == "color_changer.py":
         color_changer(self)
     if file_name == "color_quiz.py":
         color(self)
     if file_name == "disney_princess.py":
         disney_princess(self)
     if file_name == "font_change.py":
         font_change(self)
     if file_name == "hogwarts_house.py":
         hogwarts(self)
     if file_name == "mad_lib.py":
         madlib(self)
     if file_name == "mean_median.py":
         mean_median(self)
     if file_name == "meme_gen.py":
         meme_gen(self)
     if file_name == "menu.py":
         menu(self)
     if file_name == "Periodic_table.py":
         Periodic_table(self)
     if file_name == "rand_num_gen.py":
         rand_num_gen(self)
     if file_name == "spiritAnimal.py":
         spiritAnimal(self)
     if file_name == "surprise.py":
         surprise(self)
     if file_name == "third_grade_quiz.py":
         third_grade_quiz(self)
     if file_name == "wallet.py":
         wallet(self)
コード例 #3
0
ファイル: day8shell.py プロジェクト: Rajeshaalam/Python-MTA
	
2020 is a leap year
>>> m = int(input("enter the month:"))
enter the month:8
>>> d = month(y,m)
>>> print(d)
    August 2020
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
31

>>> print(calendar(y))
                                  2020

      January                   February                   March
Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
       1  2  3  4  5                      1  2                         1
 6  7  8  9 10 11 12       3  4  5  6  7  8  9       2  3  4  5  6  7  8
13 14 15 16 17 18 19      10 11 12 13 14 15 16       9 10 11 12 13 14 15
20 21 22 23 24 25 26      17 18 19 20 21 22 23      16 17 18 19 20 21 22
27 28 29 30 31            24 25 26 27 28 29         23 24 25 26 27 28 29
                                                    30 31

       April                      May                       June
Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
       1  2  3  4  5                   1  2  3       1  2  3  4  5  6  7
 6  7  8  9 10 11 12       4  5  6  7  8  9 10       8  9 10 11 12 13 14
コード例 #4
0
ファイル: calendar.py プロジェクト: vasavi-test/python
import calendar
month = int(raw_input("enter month"))
year = int(raw_input("enter year"))
print calendar(month, year)
コード例 #5
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
# @author: vera


def time():
    import time
    ticks = time.time()
    print '当前时间为:', ticks

    localtime = time.localtime(time.time())
    print '本地时间为', localtime

    localtime = time.asctime(time.localtime(time.time()))
    print '本地时间为', localtime

    clock = time.clock()
    print '当前时间为:', clock


def calendar():
    import calendar
    cal = calendar.month(2017, 6)
    print 'calendar of June, 2017:'
    print cal


if __name__ == '__main__':
    time()
    calendar()
コード例 #6
0
ファイル: 14_cal.py プロジェクト: RobinSrimal/Intro-Python-I
   the format that your program expects arguments to be given.
   Then exit the program.

Note: the user should provide argument input (in the initial call to run the file) and not 
prompted input. Also, the brackets around year are to denote that the argument is
optional, as this is a common convention in documentation.

This would mean that from the command line you would call `python3 14_cal.py 4 2015` to 
print out a calendar for April in 2015, but if you omit either the year or both values, 
it should use today’s date to get the month and year.
"""

import sys
import calendar
from datetime import datetime

today = datetime.today()

mycalendar = calendar.TextCalendar()


def calendar(a=today.month, b=today.year):

    print(mycalendar.formatmonth(b, a))


if __name__ == "__main__":
    a = int(sys.argv[1])
    b = int(sys.argv[2])
    calendar(a, b)
コード例 #7
0
''''''
'''
calendar(year,w=2,l=1,c=6)  
   打印某一年的日历【c间隔距离; w每日宽度间隔; l是每星期行数 】
isleap(year)   判断是否是闰年
leapdays(y1, y2)  [y1, y2) 中间闰年的个数
month(year,month,w=2,l=1)  打印指定月份的日历
monthcalendar(year,month)  
   返回一个整数的单层嵌套列表。每个子列表装载代表一个星期的整数。
   Year年month月外的日期都设为0;范围内的日子都由该月第几日表示,从1开始。
monthrange(year,month)  
   返回两个整数。第一个是该月的星期几的日期码,第二个是该月的日期码。
   日从0(星期一)到6(星期日);月从1到12。
'''

import calendar
c = calendar.calendar(2018, w=2, l=1, c=6)
# print(c)

print(calendar.isleap(2018))  # False
print(calendar.leapdays(1000, 2000))  # 242
m = calendar.month(2018, 7, w=2, l=1)
print(m)
print(calendar.monthcalendar(2018, 7))
print(calendar.monthrange(2018, 7))


コード例 #8
0
from calendar import *

print(month(2100, 2))
print(calendar(2019))
print(weekday(2019, 7, 10))
print(isleap(2000))  #check leap year or not o/p :- True
print(isleap(2019))  #o/p :- False
コード例 #9
0
#!/usr/bin/env python
#-*- encoding:utf-8 -*-
from calendar import *
import time
print(calendar(2018, 2, 1, 6))
test = time.localtime()
print(monthcalendar(2018, 1))
print(test[2])
mothArry = monthcalendar(2018, 1)
count = 0
nowlist = []
for i in mothArry:
    print(i, end="\t")
    for j in i:
        if test[2] == j:
            count += 1
            print(count, ">>")
            nowlist = i
            print(nowlist)
print(nowlist)
print(nowlist[0])
コード例 #10
0
def home(request):
    """
    Show calendar of events this month
    """
    lToday = datetime.now()
    return calendar(request, lToday.year, lToday.month)
コード例 #11
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
# @author: vera

def time():
	import time
	ticks = time.time()
	print '当前时间为:', ticks

	localtime = time.localtime(time.time())
	print '本地时间为', localtime

	localtime = time.asctime(time.localtime(time.time()))
	print '本地时间为', localtime

	clock = time.clock()
	print '当前时间为:', clock

def calendar():
	import calendar
	cal = calendar.month(2017, 6)
	print 'calendar of June, 2017:'
	print cal

if __name__ == '__main__':
	time()
	calendar()
コード例 #12
0
ファイル: calendar.py プロジェクト: Shaikaslam340/calendar
from calendar import *
a = int(input("Enter the Year to get calendar: "))
print(calendar(a, 2, 1, 10))
コード例 #13
0
ファイル: mod.py プロジェクト: SwatiAbhii/class_1000
# def hello():
# 	''' This function prints the greetings'''
# 	print('This is in the print statement from hello function hello\n')
# print(hello.__doc__)
# hello()
# import math
# from math import *
# print(math.pi)
# print(math.factorial(5))
# print(pi)
# print(factorial(5))
# print(dir(math))
# print(sin(pi))
# import time
# from time import *
# from time impor
# print(dir(	time))
# print(help(time))
# print(time())
# # t = (localtime())
# sleep(5)
# print(asctime())
import calendar
from calendar import *
print(calendar(2018))
print(month(2018, 8))

コード例 #14
0
ファイル: calserver.py プロジェクト: wwq0327/PyNP
 def getYear(self, year):
     return calendar(year)
コード例 #15
0
    def time_ago_parser(self):
        """
		Parse time ago into proper datetime
		Eg: 2 days ago
		"""
        parsed_arbitrary_time = self.spacer(self.__arbitrary_time)
        time_element_list = [
            i for i in parsed_arbitrary_time.split(' ') if i != ''
        ]
        publish_time = self.__curent_time

        current_index = 0
        time_ago_dict = {'days': 0, 'hours': 0, 'minutes': 0}
        real_time_dict = {
            'year': publish_time.year,
            'month': publish_time.month,
            'day': publish_time.day,
            'hour': publish_time.hour,
            'minute': publish_time.minute
        }

        while current_index < len(time_element_list):
            # Update day
            if time_element_list[current_index] == self.__day_indicator:
                time_ago_dict['days'] = int(time_element_list[current_index -
                                                              1])
            # Update hour
            if time_element_list[current_index] == self.__hour_indicator:
                time_ago_dict['hours'] = int(time_element_list[current_index -
                                                               1])
            # Update minute
            if time_element_list[current_index] == self.__minute_indicator:
                time_ago_dict['minutes'] = int(
                    time_element_list[current_index - 1])
            current_index += 1

        real_time_dict['day'] = publish_time.day - time_ago_dict['days']
        real_time_dict['hour'] = publish_time.hour - time_ago_dict['hours']
        real_time_dict[
            'minute'] = publish_time.minute - time_ago_dict['minutes']

        if real_time_dict['minute'] < 0:
            real_time_dict['minute'] += 60
            real_time_dict['hour'] -= 1
        if real_time_dict['hour'] < 0:
            real_time_dict['hour'] += 24
            real_time_dict['day'] -= 1
        if real_time_dict['day'] < 0:
            real_time_dict['day'] += calendar(publish_time.year,
                                              publish_time.month)[1]
            real_time_dict['month'] -= 1
        if real_time_dict['month'] < 0:
            real_time_dict['month'] += 12
            real_time_dict['year'] -= 1

        publish_time = publish_time.replace(year=real_time_dict['year'],
                                            month=real_time_dict['month'],
                                            day=real_time_dict['day'],
                                            hour=real_time_dict['hour'])

        return publish_time
コード例 #16
0
master = tk.Tk()

master.geometry("300x300+300+300")
tk.Label(master, text="First Name").grid(row=1)
tk.Label(master, text="Last Name").grid(row=2)

e1 = tk.Entry(master)
e2 = tk.Entry(master)

e1.grid(row=1, column=1)
e2.grid(row=2, column=1)

cal = calendar(master,
               font="Arial 14",
               selectmode='day',
               cursor="hand1",
               year=2018,
               month=2,
               day=5)
cal.pack(fill="both", expand=True)

tk.Button(master, text='Salir', command=master.quit).grid(row=7,
                                                          column=2,
                                                          sticky=tk.W,
                                                          pady=4)
tk.Button(master, text='Mostrar', command=show_entry_fields).grid(row=7,
                                                                  column=1,
                                                                  sticky=tk.W,
                                                                  pady=4)

tk.mainloop()
コード例 #17
0
	#%a 本地简化星期名称%A 本地完整星期名称 %b 本地简化的月份名称 %B 本地完整的月份名称
	#

	#将格式字符串转化为时间戳
	a='Tue Jun 20 10:52:44 2017'
	print time.mktime(time.strptime(a,'%a %b %d %H:%M:%S %Y'))

def calendar():

	import calendar#引入calender

	#获取某月日历
	cal=calendar.month(2017,1)
	print '以下输出2017年1月的日历 '
	print cal

	#判断是否为闰年
	print calendar.isleap(2016)
	print calendar.isleap(2017)

	#获取某年日历
	print calendar.calendar(2017,w=2,l=1,c=6)






if __name__=='__main__':
	time(),calendar()
コード例 #18
0
        continue
    print(x)
    i += 1
'''Time: 	Give time functionality from all time zomes,  including cpu frequncy 
    and system details this python is using
	
	time() gives sec passed from epoc time from linux publically released

	'''

# from time import *

# #print(time())

# print(asctime()) # ansyncronous time
# #sleep(<int>) # stop programming for given time in secs
# print(time())
# sleep(7)
# print(time())
# print(sleep())
'''
Calendar:
	Gives calendar functionality

'''
from calendar import *
print(calendar(2018))

print(month(2018, 7))

print(week())