i need help i thought i was doing it right but later when i looked at data it turned out to be something else
I have 4 lines of code that i want to convert to single line list comprehension
`newLst=[]
for each in os.listdir(locationTxt):
if os.path.isdir(os.path.join(locationTxt,each)):
if each not in hideTheseFolders:#hide directory in scrolllist
newLst.append(each)
for nfile in ["ma","jpg","png","mb",'iff','tga','tif']:
if each.endswith(nfile):
newLst.append=self.sizeof(os.path.join(locationTxt,each)))`
and I want to write in just one line,
`for each in [each for each in os.listdir(locationTxt) if os.path.isdir(os.path.join(locationTxt,each)) and each not in hideTheseFolders]:
newLst.append(each)
for nfile in ["ma","jpg","png","mb",'iff','tga','tif']:
if each.endswith(nfile):
newLst.append=self.sizeof(os.path.join(locationTxt,each)))`
and hideTheseFolders is a list that has...
["thumb",".thumb",".mayaSwatches","RECYCLER","$AVG","$Recycle.Bin","$RECYCLE.BIN","INCINERATE","Config.Msi","System Volume Information","Recovery","ProgramData","PROGRAMDATA","PerfLogs"]
but instead of just filtering out these folders I end up with just the folders and no file is visible..
pls help adding files of the jpg, tif or png and the folders to the newLst list...