Pythonの小さな練習-pythonは巨大で簡単な目覚まし時計の機能を書きます
1260 ワード
オーディオファイルの挿入と.pyファイルの同級ディレクトリの下
import winsound #
import time # ,
#
my_hour = input(" :")
my_minute = input(" :")
flag = 1
while flag:
t = time.localtime() #
fmt = "%H %M"
now = time.strftime(fmt, t) # 、
now = now.split(' ') # , 、 now
hour = now[0]
minute = now[1]
if hour == my_hour and minute == my_minute:
music = 'Good Time.wav'
winsound.PlaySound(music, winsound.SND_ALIAS)
flag = 0