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.