简体   繁体   中英

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

Actually I was writing a program in python to create a audio lopper I want to take input from user for no of times to loop and and i want to download the file can any one help me

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

You can just use the input() function to take input from the user and then int() to typecast it into an integer(default input type is a string).

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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