Kent's suggestions are always my favorites, along with others,
c. --nevermind
To get the full path in your list-- change Kent's to this
import os
filelist = []
for root,directories,filenames in os.walk("Aircraft"):
for filename in filenames:
if filename.endswith("-set.xml"):
Something like this (not tested!):
import os
for dirpath, dirnames, filenames in os.walk('Aircraft'):
for filename in filenames:
if filename.endswith('-set.xml'):
print filename[:-8]
This is probably a good time to mention Jason Orendorff's wonderful path module, which makes
What I want to do is rather simple, but I cannot find any good
documentation for something like this.
The directory structure is sort of like this:
>Aircraft
>>A-10
+A-10cl-set.xml
+A-10fg-set.xml
For example Aircraft/A-10/A-10cl-set.xml
Now I want to loop though each aircrafts folder (such as A