Anonymous user
Walk a directory/Recursively: Difference between revisions
→{{header|Python}}: First example changed to work on Python 3.x too
(→{{header|Python}}: First example changed to work on Python 3.x too) |
|||
Line 1,264:
=={{header|Python}}==
{{works with|Python|3.x}}
{{works with|Python|2.3+}}
This uses the standard ''os.walk()'' "[[generator]]".
<lang python>import
rootPath = '/'
extension = '.mp3'
for root, dirs, files in os.walk(rootPath):
for filename in
if
print( os.path.join(root, filename))</lang>
{{works with|Python|<nowiki>2.x</nowiki>}}
|