Search notes:

Python standard library: glob

Python standard library glob: find filenames with wildcards.

Simple example

import os
import sys
import glob

if len(sys.argv) < 3:

   print
   print "Usage       ", sys.argv[0], " dir suffix"
   print 'For example ', sys.argv[0], ' c:\\temp txt'
   exit

dir_   = sys.argv[1]
suffix = sys.argv[2]

os.chdir (dir_)

matched_files = glob.glob("*." + suffix)

print "\n".join(matched_files)
Github repository about-python, path: /standard-library/glob/glob.py

See also

os.walk creates a generator that produces a directory's subdirectories and their files.
os.scandir() and os.listdir()
standard library

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1745041908, '18.191.176.192', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Python/standard-library/glob/index(67): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78