用python做一个简易休息提醒

版权声明:本文为博主原创文章,非商用转载请保持署名-注明出处。 https://blog.csdn.net/adan_journal_of_data/article/details/77758269

来源:Udacity《编程基础:Python》课程2

功能:每隔30分钟,打开特定网页来提醒休息

#coding:utf-8
import webbrowser 
import time

total_breaks = 3
break_count = 0

print "\nThis program started on: " + time.ctime()  # time.ctime():current time(sec)
while break_count <= total_breaks: 
    time.sleep(30 * 60# time.sleep():sleep time(sec) ,30 min
    print "\nBreak Time!\t" + time.ctime()
    webbrowser.open("https://cn.udacity.com/course/programming-foundations-with-python--ud036")  # 开网页
    break_count = break_count + 1
展开阅读全文

没有更多推荐了,返回首页