Created
February 26, 2015 08:20
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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