diff options
Diffstat (limited to 'monsterdb.py')
-rw-r--r-- | monsterdb.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/monsterdb.py b/monsterdb.py new file mode 100644 index 0000000..5235b5f --- /dev/null +++ b/monsterdb.py @@ -0,0 +1,16 @@ + +monster_db = {} + + +def read_monster_db(file='monsterdb.txt'): + with open(file) as f: + for l in f.readlines(): + try: + index = l.index(' ') + monster_id = int(l[:index]) + monster_name = l[index + 1:-1] + monster_db[monster_id] = monster_name + except ValueError: + pass + + return monster_db |