Spaces:
Runtime error
Runtime error
File size: 1,736 Bytes
e0cfb39 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
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) |