hey im working on a project that is downloading images from a url without knowing how many there are, they all have the same url but the number changes like www.url000.png www.url0001.png and so on i want to create a loop that download all the png files untill there are no more left then it stops here is my code for the download thanks for helping (first question here btw so sorry if its too long)
count = 1
fnum = str()
if len(str(count)) == 1:
fnum = '00000' + str(count)
elif len(str(count)) == 2:
fnum = '0000' + str(count)
elif len(str(count)) == 3:
fnum = '000' + str(count)
else:
print('error')
os.chdir(fullpath)
urllib.request.urlretrieve(url + fnum + extention, str(count) + extention)
print('Downloading ' + str(count))
count = count + 1