繁体   English   中英

我想通过用户输入 while 循环,我想下载最终结果

[英]I want to take input for while loop by user and i want download the end result

实际上,我在 python 中编写了一个程序来创建一个音频循环器,我想从用户那里获取输入,而不是循环播放,我想下载文件,有人能帮我吗

count = 0
while count < 108:
import playsound
import time
playsound.playsound("C:\\Users\\admin\\Desktop\\SAMPLE\\m1.mp3" )
time.sleep(10)
count = count+1

您可以只使用input() function 从用户那里获取输入,然后使用int()将其转换为整数(默认输入类型是字符串)。

import playsound
import time

user_input = int(input('enter number: '))
count = 0
while count < user_input:
    playsound.playsound("C:\\Users\\admin\\Desktop\\SAMPLE\\m1.mp3" )
    time.sleep(10)
    count = count+1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM