Whenever I run this code, it always returns an empty list, can someone tell me why this is happening?

## Written by Tom Tetlaw
## Copyright (c) 2009
## Written in IDLE<www.python.org>

import sys, os
import re
sys.path.append('E:/Tom\'s Personal Project/engine')
import shared.useful.Useful
import shared.charactors

##TODO:
## Make the Monster class have the type param

class WorldLoader:
    def __init__(self):
        pass

    def loadWorlds(self):
        if not os.path.exists('maps/'):
            os.mkdir('maps/')
        final = os.listdir('maps/')
            
        mdata = {}
        morder = []
        mfinal = []
        
        iorder = []
        idata = {}
        ifinal = []

        monsters = []
        items = []

        for fitem in final:
            for witem in os.listdir('maps/'+fitem):
                fout = open('maps/'+fitem+'/'+witem,'r')
                if witem == 'items.i_tpp':
                    iorder = []
                    idata = {}
                    ifinal = []
                    for line in fout.readlines():
                        field, value = line.strip().replace(' ','').split('=')
                        idata[field] = value
                    fout.close()
                    for i in range(len(idata)):
                        iorder.append('item'+str(i))
                    for item in iorder:
                        ifinal.append(str(idata[item]))
                    items.append(ifinal)
                elif witem == 'monsters.m_tpp':
                    morder = []
                    mdata = {}
                    mfinal = []
                    for line in fout.readlines():
                        field, value = line.strip().replace(' ','').split('=')
                        mdata[field] = value
                    fout.close()
                    for i in range(len(mdata)):
                        morder.append('monster'+str(i))
                    for item in morder:
                        mfinal.append(str(mdata[item]))
                    monsters.append(mfinal)

wl = WorldLoader()
p = wl.loadWorlds()
print(p)

my file heirachy:

engine
{
    world
    {
        WorldLoader.py
        maps
        {
            world0
            {
                items.i_tpp
                monsters.m_tpp
            }
            world1
            {
                items.i_tpp
                monsters.m_tpp
            }
        }
    }
}

Ask if you want me to attach the items and monsters files.

Any and all help will be greatly appreciated, thanks in advance for your time. :):)

This question has already been answered. Start a new discussion instead.