Last active
December 21, 2018 03:47
-
-
Save ayutaz/565a2f9de72b09300aed6947bfd0b85d to your computer and use it in GitHub Desktop.
ターミナルで時間を知らせる ref: https://qiita.com/ayousanz/items/e6508a0cd8e8901ec531
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding:utf-8 | |
# まずは,入力した時間になったらターミナルで知らせてくれるものを作ってみる | |
from datetime import datetime | |
from time import sleep | |
print(datetime.now()) | |
my_time_hour=int(input("時間を入力してください:")) | |
my_time_minute=int(input()) | |
while True: | |
h=int(datetime.now().hour) | |
m=int(datetime.now().minute) | |
s=int(datetime.now().second) | |
if my_time_hour == h and my_time_minute==m: | |
print(str(h)+":"+str(m)) | |
print("おしらせします") | |
break | |
num=60-s#CPUの消費量を抑えるためにために,残りの時間をsleepにする. | |
sleep(num) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment