0
os.chdir(pasta)
lista = []
for air in os.walk('.'):
if lista != []:
lista.append(air)
print(lista)
Could someone tell me why I can’t print the folders?
If I take the if
, folders appears, but also appears []
.
[('.', ['Game_play', 'Menu', 'Settings', 'Setup'], ['testes.json']), ('.\\Game_play', ['tc001.air', 'tc002.air', 'tc003.air'], []), ('.\\Game_play\\tc001.air', [], ['tc001.py']), ('.\\Game_play\\tc002.air', [], ['tc002.py']), ('.\\Game_play\\tc003.air', [], ['tc003.py']), ('.\\Menu', ['tc001.air'], []), ('.\\Menu\\tc001.air', [], ['tc001.py']), ('.\\Settings', ['tc001.air'], []), ('.\\Settings\\tc001.air', [], ['tc001.py']), ('.\\Setup', ['tc001.air'], []), ('.\\Setup\\tc001.air', [], ['tc001.py'])]
Process finished with exit code 0
I can’t print just the folders without those []
with nothing.