glob module finds all the pathnames matching a specified pattern according to the rules used by the Unix shell. The results are returned in arbitrary order. Linux and Unix systems and shells also support glob and also provide function
glob() in system libraries.
glob.glob(pathname, *, recursive=False)
Return a list of pathnames that match pathname, which must be a string containing a path specification. pathname can be either absolute or relative, and can contain shell-style wildcards. Broken symlinks are included in the results (as in the shell)
If recursive is true, the pattern “
**” will match any files and zero or more directories, subdirectories, and symbolic links to directories. If the pattern is followed by an
os.altsep then files will not match.
glob.iglob(pathname, *, recursive=False)
Return an iterator which yields the same values as
glob() without actually storing them all simultaneously. Raises an auditing event
glob.glob with arguments
Escape all special characters (
'['). This is useful if you want to match an arbitrary literal string that may have special characters in it. Special characters in drive/UNC sharepoints are not escaped, e.g. on Windows