Anonymous user
Walk a directory/Recursively: Difference between revisions
→{{header|Python}}: Add Python 3 method via pathlib.Path.rglob()
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
(→{{header|Python}}: Add Python 3 method via pathlib.Path.rglob()) |
||
Line 1,798:
=={{header|Python}}==
{{works with|Python|3.x}}
Use the standard [https://docs.python.org/3/library/pathlib.html#pathlib.Path.rglob pathlib.Path.rglob()] module to recursively walk a directory with optional filter.
<lang python>
from pathlib import Path
for path in Path('.').rglob('*.*'):
print(path)
</lang>
{{works with|Python|3.x}}
{{works with|Python|2.3+}}
|