Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # MyAlarm.py
- # Python 3.4.3
- # Display date & time; display contents of text file at a given time
- # Chris Clarke
- # 05.07.2015
- import time
- from time import localtime, strftime
- #filename = 'HappyBirthday.txt'
- #filename = 'HappyNewYear.txt'
- filename = 'Time.txt' # or create your own message in a text file
- h_set = int(input("Alarm: set hour (0-23): "))
- m_set = int(input("Now, set minute (0-59): "))
- while True:
- local_t = localtime( time.time())
- h=local_t.tm_hour
- m=local_t.tm_min
- s=local_t.tm_sec
- if h==h_set and m==m_set and s==0: break
- print(strftime("%a, %d %B %Y %H:%M:%S", local_t))
- while local_t==localtime( time.time()):
- pass
- with open(filename) as f:
- for line in f:
- print (line, end='')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement