python function returns multiple dicts instead of one
<p>Why does this recursive function keep returning multiple dictionaries instead of just one.</p>

<pre><code>def retFiles(dir):
    data = {}
    root = set()
    os.chdir(dir)
    cwd = os.getcwd()
    for i in os.listdir(cwd):
        if os.path.isfile(i):
            data.setdefault(i, set())
            root.add(os.path.relpath(dir).replace("\\", "/"))
            data[i] = root
        else:
            preisci(i)
    print(data)
</code></pre>
