DEVILSAN
11-07-2012, 06:04 AM
I was about to post a problem here and while i was posting i discovered a solution looking at the code,
for each in os.listdir(locationTxt):
if os.path.isdir(os.path.join(locationTxt,each)):
if each not in hideTheseFolders:#hide directory in scrolllist
cmds.textScrollList('fileLister',edit=True,append=each)
the code above is self explanatory of what i want to achieve,
so through list comprehension in just two lines,
for each in [each for each in os.listdir(locationTxt) if os.path.isdir(os.path.join(locationTxt,each)) and each not in hideTheseFolders]:
cmds.textScrollList('fileLister', edit=True,append=each)
so now I understood list comprehension i hope this logic helps someone else too...
for each in os.listdir(locationTxt):
if os.path.isdir(os.path.join(locationTxt,each)):
if each not in hideTheseFolders:#hide directory in scrolllist
cmds.textScrollList('fileLister',edit=True,append=each)
the code above is self explanatory of what i want to achieve,
so through list comprehension in just two lines,
for each in [each for each in os.listdir(locationTxt) if os.path.isdir(os.path.join(locationTxt,each)) and each not in hideTheseFolders]:
cmds.textScrollList('fileLister', edit=True,append=each)
so now I understood list comprehension i hope this logic helps someone else too...
