Walk a directory/Non-recursively: Difference between revisions

→‎{{header|Python}}: compatibility with Python 3
m (added a ;Related task: (bold) header, added other whitespace to the task's preamble.)
(→‎{{header|Python}}: compatibility with Python 3)
Line 970:
<lang python>import glob
for filename in glob.glob('/foo/bar/*.mp3'):
print (filename)</lang>
Or manually:
<lang python>import os
for filename in os.listdir('/foo/bar'):
if filename.endswith('.mp3'):
print (filename)</lang>
 
=={{header|R}}==
Anonymous user