VaF*_*ncy 1 python python-2.7 raspberry-pi
from subprocess import call
try:
while True:
call (["raspivid -n -b 2666666.67 -t 5000 -o test.mp4"],shell=True)
call (["raspivid -n -b 2666666.67 -t 5000 -o test1.mp4"],shell=True)
except KeyboardInterrupt:
pass
Run Code Online (Sandbox Code Playgroud)
当我按任何按钮时,我打算让它打破循环.但是我尝试了许多方法来打破它们并且没有一个工作.
您希望您的代码更像这样:
from subprocess import call
while True:
try:
call(["raspivid -n -b 2666666.67 -t 5000 -o test.mp4"], shell=True)
call(["raspivid -n -b 2666666.67 -t 5000 -o test1.mp4"], shell=True)
except KeyboardInterrupt:
break # The answer was in the question!
Run Code Online (Sandbox Code Playgroud)
你break完全按照你的期望循环.
| 归档时间: |
|
| 查看次数: |
19740 次 |
| 最近记录: |