print(current_pokemon_suffix_list) # Build list of pokemon with dashes in their name that fit the profile mentioned above dashpokemonlist = list() for pokemon in pokemon_unique_list: #Step 1 check if name has dash if "-" in pokemon[1]: #Step 2 find nationalID of the corresponding uniqueID # Only 1 instance will be returned, to access get the 0 position of the list, # Nat ID is in the 1 pos nationalID = function_pokemonID.returnPokemonNationalIDFromUniqueID( pokemon[0], c)[0][1] #Step 3, use nationalID to find how many uniqueID's are returned uniqueIDlist = function_pokemonID.returnPokemonUniqueIDFromNationalID( nationalID, c) #Step 4, if the size of list is bigger than 1, and the uniqueID is not already in the list # than we can safely add to the dashpokemonlist if len(uniqueIDlist) > 1: pokemonAlreadyPresent = False for suffix in current_pokemon_suffix_list: if pokemon[0] == suffix[0]: pokemonAlreadyPresent = True if not pokemonAlreadyPresent: dashpokemonlist.append(pokemon) print(dashpokemonlist) for pokemon in dashpokemonlist: #Last step add the pokemon to the suffix table, rename the pokemon in unique info table
current_pokemon_suffix_list = c.execute("select * from pokemon_suffix").fetchall() print(current_pokemon_suffix_list) # Build list of pokemon with dashes in their name that fit the profile mentioned above dashpokemonlist = list() for pokemon in pokemon_unique_list: #Step 1 check if name has dash if "-" in pokemon[1]: #Step 2 find nationalID of the corresponding uniqueID # Only 1 instance will be returned, to access get the 0 position of the list, # Nat ID is in the 1 pos nationalID = function_pokemonID.returnPokemonNationalIDFromUniqueID(pokemon[0], c)[0][1] #Step 3, use nationalID to find how many uniqueID's are returned uniqueIDlist = function_pokemonID.returnPokemonUniqueIDFromNationalID(nationalID, c) #Step 4, if the size of list is bigger than 1, and the uniqueID is not already in the list # than we can safely add to the dashpokemonlist if len(uniqueIDlist) > 1: pokemonAlreadyPresent = False for suffix in current_pokemon_suffix_list: if pokemon[0] == suffix[0]: pokemonAlreadyPresent = True if not pokemonAlreadyPresent: dashpokemonlist.append(pokemon) print(dashpokemonlist) for pokemon in dashpokemonlist: #Last step add the pokemon to the suffix table, rename the pokemon in unique info table
# If title text matches "Level " including space, for the last 6 charactders # construct string with level number if "Level " == method[-6:]: # obtain what level, which is always characters -6 to -4 level = evoinfo.get('src')[-6:-4] method = method + level # Special case where pokemon needs to be traded for a specific pokemon if "Trade with " == method: # obtain which pokemon, which is always characters -7 to -4 nationalID specialpokemonNatID = evoinfo.get('src')[-7:-4] uniqueIDtoSearch = function_pokemonID.returnPokemonUniqueIDFromNationalID(int(specialpokemonNatID), c)[0][0] # use that to find the name specialname = function_pokemonID.returnPokemonNamefromUniqueID(uniqueIDtoSearch, c)[0][1] method = method + specialname print(pokemons["name"]+"-->"+evo+" ("+method+")") c.execute("INSERT into pokemon_evolutions values (?,?,?)", (uniqueID, evolutionIDlist[0][0], method)) conn.commit()