Keep names of subfolders in a list : <p>In this a variable there is a folder called <code>main_folder</code>.
This folder has two folders:</p>

<p><code>111</code>,<code>222</code></p>

<p>I need to get the names of these folders in a list.</p>

<p>Tried this:</p>

<pre><code>a = r'C:\Users\user\Desktop\main_folder'
import os 
for root, dirs, files in os.walk(a):
    print(dirs)
</code></pre>

<p>gives:</p>

<pre><code>['111', '222'] # &lt;--------------This only needed
[]
[]
</code></pre>

<p>How to keep only the first list and not the empty ones which I think describe the contents of these folders since they don't have folders.</p>
