can_this_pokemon_evolve / whatever stuff is neede /thing that generates pokemons csvs from the other one.py
dpe1's picture
big chungus license means big chungus holds legal rights to the file called app.py and wahtever.py and the rest is from pokemon.db i have no rights to it and to the best of my knowledge neither does big chungus thank you for your understanding
e0cfb39
import csv
with open('input_pkmn_stats_and_evolutions.xlsx - pkmn_stats.csv', 'r') as input_pkmn_stats_and_evolutions: aoias = list(csv.reader(input_pkmn_stats_and_evolutions, delimiter=","))
evolvable_pokemons = [i[11].lower() for i in aoias if i[11]!=''][1:]
all_pokemons = [i[0].lower() for i in aoias][1:]
with open('evolvable pokemons.txt', 'w',newline='') as idk:idk.write(','.join(evolvable_pokemons))
with open('all pokemons.txt', 'w',newline='') as idk:idk.write(','.join(all_pokemons))
alalalala = []
def chungite(filea, stuff = None):
global alalalala
with open(filea, 'r') as stone: stone = list(csv.reader(stone, delimiter=","))
if stone[0][0] == 'Evolving from': stone=stone[1:]
for i in range(len(stone)):
stone[i][0] = stone[i][0].lower()
stone[i][1] = stone[i][1].lower()
if stuff is not None: stone[i][2] = f'{stuff}{stone[i][2]}' if stone[i][2]!='' else stuff
if '\n' in stone[i][0]:
k=stone[i].copy()
stone[i][0] = stone[i][0].split('\n')[0]
k[0]=k[0].split('\n')[1]
if '\n' in stone[i][1] :
stone[i][1] = stone[i][1].split('\n')[0]
k[1]=k[1].split('\n')[1]
stone.append(k)
alalalala.extend(stone)
with open(filea, 'w', newline='') as news:
damn = csv.writer(news)
damn.writerows(stone)
chungite('level.csv', 'Evolves by level. ')
chungite('stone.csv', 'Evolves by stone: ')
chungite('trading.csv', 'Evolves by trading. ')
chungite('friendship.csv', 'Evolves by friendship. ')
chungite('special.csv', 'Evolves by special condition: ')
with open('all.csv', 'w', newline='') as news:
damn = csv.writer(news)
damn.writerows(alalalala)