簡體   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