-
Notifications
You must be signed in to change notification settings - Fork 0
/
createMoveDB.py
33 lines (26 loc) · 923 Bytes
/
createMoveDB.py
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
from moves import Moves
import csv
# create instance
moves = Moves()
print('Querying API for move information...')
moves.GetAllMoves()
print('Finished getting move information')
print('Writing file...')
with open('move_database.csv', 'w', newline='') as moveDB:
writer = csv.writer(moveDB, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
headers = ['Name', 'Description', 'Type', 'Category', 'Power', 'Accuracy', 'PP']
writer.writerow(headers)
for move in moves.moves:
# get each piece of information
name = move.name
description = move.description
moveType = move.type
category = move.category
power = move.power
accuracy = move.accuracy
pp = move.pp
# contrsuct the row
row = [name, description, moveType, category, power, accuracy, pp]
# write the row
writer.writerow(row)
print('Finished!')