import urllib.request
baseURL = "https://assets.pokemon.com/assets/cms2/img/pokedex/detail/"
endURL = ".png"
pokemonDirectory = "Folder location to store the images"
for pokemon in range(1, 807):
try:
pokemon = str(pokemon)
if len(pokemon) == 1:
pokemon = "00" + pokemon
elif len(pokemon) == 2:
pokemon = "0" + pokemon
combinedURL = baseURL + pokemon + endURL
savePokemon = pokemonDirectory + pokemon + endURL
urllib.request.urlretrieve(combinedURL, savePokemon)
except:
print("Failed to collect pokemon: " + pokemon)
print("Pokemon Collection Finished")