Write a timer reminder program in Python __python

Source: Internet
Author: User
The body is the capital of revolution, health, we have more energy to do what we want to do, the pursuit of the goddess, the pursuit of dreams. However, the programmer is a bitter career, most of the time on the computer, I now cervical vertebra is not good, sometimes the eyes still ache, I have not 20 ah, sad ... So wrote a small program, specify the time will open the browser to play a piece of music, remind us to rest for a while, to prevent our sudden death, said more are tears.

More basic, suitable for Python beginners and students interested in Python reading.


Let's run through this program, probably function is: we set a time, the time will open the browser to play a section of audio.
1. Wait
2. Open the browser and play the audio.
3. Repeat (1, 22 steps). Because we have to rest several times in a day, Cycle 3 times good. )

Open the Python IDLE, let's get started.


Import time
import webbrowser
 
Total_breaks = 3 #重复3次
break_count = 0 while
 
 
 
(Break_count < Total_ Breaks): #当break_count < Total_breaks execute the following code
    time.sleep #程序等待时间, wait for 1h
    webbrowser.open ("https:// Www.youtube.com/watch?v=ASO_zypdnsQ ") #打开指定网页
    break_count = break_count + 1 #初始break_count = 0, run once per +1


A few lines of code are done, and Python is really friendly to beginners.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.