Skip to content

Instantly share code, notes, and snippets.

@aravindhkumar23
Created February 26, 2015 08:20
Show Gist options
  • Save aravindhkumar23/885c14ec159b83b30207 to your computer and use it in GitHub Desktop.
Save aravindhkumar23/885c14ec159b83b30207 to your computer and use it in GitHub Desktop.
python gets folder name and file how to iterate and get the for loop value in dashboard page.--Django
import os
k=[]
l=[]
lis=[]
rootDir = '.'
for dirName, subdirList, fileList in os.walk(rootDir, topdown=False):
# print("dir is " , dirName)
lis=lis+[dirName]
for fname in fileList:
# print("file is " , fname)
l=l+[fname]
# print(l)
# print(lis)
# print(l)
k=[lis]+[l]
print(k)
print(len(k))
print(k[0][1])
for i in range(len(k)):
print k[i]
for j in range(len(k[i])):
print k[i][j]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment