-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparsePokemon
More file actions
49 lines (44 loc) · 1.36 KB
/
parsePokemon
File metadata and controls
49 lines (44 loc) · 1.36 KB
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
39
40
41
42
43
44
45
46
47
48
49
import csv
def makeListFromString(s):
isWord = False
result = []
currentWord = ""
for c in s:
if isWord:
currentWord += c
if c == "," and isWord:
result.append(currentWord[2:-2])
currentWord = ""
isWord = not isWord
elif c == ",":
isWord = not isWord
return result
pokemonList = dict()
with open("pokemon-data.csv", "r") as file:
csvreader = csv.reader(file, delimiter=";")
for pokemon in csvreader:
pokemonList[pokemon[0]] = {
"Type": pokemon[1],
"Abilities": makeListFromString(pokemon[2]),
"HP": pokemon[4],
"Attack": pokemon[5],
"Defense": pokemon[6],
"Special Attack": pokemon[7],
"Special Defense": pokemon[8],
"Speed": pokemon[9],
"Evolution": pokemon[10],
"Move Set": makeListFromString(pokemon[11])
}
moveList = dict()
with open("move-data.csv", "r") as file:
csvreader = csv.reader(file, delimiter=",")
for move in csvreader:
moveList[move[1]] = {
"Type": move[2],
"Category": move[3],
"PP": move[5],
"Power": move[6],
"Accuracy": move[7]
}
index = 32
print(pokemonList["Aron"]["Move Set"][index], moveList[pokemonList["Aron"]["Move Set"][index]])