On this page
  1. fnmatch.filter
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

fnmatch.filter

Up: fnmatch | Next: fnmatch.filterfalse
Rel: fnmatch.filterfalse, fnmatch.fnmatch, fnmatch.fnmatchcase, fnmatch.translate
Ref: docs.python.org — fnmatch.filter
Tags: #public #python3 #stdlib #fnmatch


Import

import fnmatch
from fnmatch import filter

Signature & Overview

fnmatch.filter(names, pat)

Construct a list from those elements of the iterable NAMES that match PAT.

Usage

import fnmatch

assert fnmatch.filter(["a.py", "b.txt", "c.py"], "*.py") == ["a.py", "c.py"]

Gotchas

REPL Inspect

from fnmatch import filter
help(filter)

Linked from

Related notes